mirror of
https://github.com/talktao/Vue3-Vite-Vant-TS-H5.git
synced 2025-05-21 22:02:24 +08:00
fix:跨域配置
This commit is contained in:
parent
9a0e5b3c88
commit
a995aff153
@ -28,16 +28,15 @@ export default defineConfig(({ command, mode }) => {
|
||||
}),
|
||||
],
|
||||
|
||||
|
||||
|
||||
// 跨域代理
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
//这里是通过请求/api 来转发到 https://api.pingping6.com/
|
||||
//假如你要请求https://api.*.com/a/a
|
||||
//那么axios的url,可以配置为 /api/a/a
|
||||
'/api': ''
|
||||
'/api': {
|
||||
target: 'https://api.inews.qq.com',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '') // 将匹配到的api替换成''
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user