https://github.com/staven630/vue-cli4-config#proxy
proxy: {
'/api': {
target: 'http://yd.msword.top', //API服务器的地址
ws: true, //代理websockets
changeOrigin: true, // 是否跨域,虚拟的站点需要更管origin
pathRewrite: {
// '^/api5'是一个正则表达式,表示要匹配请求的url中,全部'http://localhost:8081/api5' 转接为 http://localhost:8081/api/
'^/api5': '/api',
//重写路径 比如'/api/aaa/ccc'重写为'/aaa/ccc'
'^/api': '',
}
},
'/foo': {
target: 'http://yd.abc.top'
}
},
网友评论