利用vue-cli设置反向代理解决跨域问题

在config文件夹下面的index.js里,添加如下代码即可

proxyTable: {
'/apis': { //将接口域名印射为/apis
target: 'http://192.168.3.104:3000', // 接口域名
changeOrigin: true, //是否跨域
pathRewrite: {
'^/apis': '' //需要rewrite的,
}
}
},

猜你喜欢

转载自www.cnblogs.com/FengWenQi/p/8953896.html