在overlay后
proxy: {
'/api': {
// 后端地址
target: 'http://localhost:8082/',
// 允许跨域
changeOrigin: true,
// 路径重写:我们可以应/api,替代上述后端url
pathRewrite: {
'^/api': '/'
}
}
本文详细描述了如何通过overlay配置proxy,实现API请求的跨域处理,以及如何通过pathRewrite将/api路径映射到后端服务器的8082端口上。
在overlay后
proxy: {
'/api': {
// 后端地址
target: 'http://localhost:8082/',
// 允许跨域
changeOrigin: true,
// 路径重写:我们可以应/api,替代上述后端url
pathRewrite: {
'^/api': '/'
}
}
1021
1万+

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