fix:跨域配置

This commit is contained in:
talktao 2022-09-29 15:17:41 +08:00
parent 9a0e5b3c88
commit a995aff153

View File

@ -28,16 +28,15 @@ export default defineConfig(({ command, mode }) => {
}), }),
], ],
// 跨域代理 // 跨域代理
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
proxy: { proxy: {
//这里是通过请求/api 来转发到 https://api.pingping6.com/ '/api': {
//假如你要请求https://api.*.com/a/a target: 'https://api.inews.qq.com',
//那么axios的url可以配置为 /api/a/a changeOrigin: true,
'/api': '' rewrite: (path) => path.replace(/^\/api/, '') // 将匹配到的api替换成''
}
} }
} }
}; };