vue3.x里面配置代理vue.config.js

4,636 阅读1分钟

vue.config.js文件的相关内容如下:

module.exports = {    
    devServer:{        
        open:true,        
        host:'localhost',        
        port:8081,        
        https:false,        
        proxy:{    // 配置跨域                
            '/api':{                
                target:'http://localhost:5001/api/',                
                ws:true,                
                changeOrigin:true,                
                pathRewrite:{                    
                    '^/api':''                
                }            
            }        
        }    
    }
}


欢迎访问博客:blog.csdn.net/Miss_liangr…