1.开发环境
1.在vue项目外层查找vue.config.js文件 配置proxy代理
devServer: {
// 前端启动端口
port: 80,
proxy: {
// 代理监听第一台服务器路径前缀
'/way1': {
target: 'http://localhost:8081,
ws: true,
changeOrigin: true,
pathRewrite: {
'^/way1': '/way1'
}
},
// 代理监听第二台服务器路径前缀
'/way2': {
target: 'http://localhost:8082',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/way2': '/way2'
}
}
}
}