如下:
proxyTable: {
'/paas': {
target: "http://localhost:8081",
changeOrigin: true, //可否跨域
pathRewrite: {
'^/paas': '' //重写接口,去掉/paas
}
}
},
target 是小写!!!
本文详细介绍了如何使用proxyTable配置代理,实现跨域请求。通过设置target为'http://localhost:8081',并开启changeOrigin属性,再利用pathRewrite重写接口路径,有效解决了前端开发中常见的跨域问题。
如下:
proxyTable: {
'/paas': {
target: "http://localhost:8081",
changeOrigin: true, //可否跨域
pathRewrite: {
'^/paas': '' //重写接口,去掉/paas
}
}
},
target 是小写!!!

被折叠的 条评论
为什么被折叠?