配置(开发环境): 增加Vite代理以解决本地CORS
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
VITE_BASE_URL = 'http://localhost:5157'
|
||||
VITE_BASE_URL=/api
|
||||
|
||||
+8
-1
@@ -15,6 +15,13 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 5158
|
||||
port: 5158,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://localhost:5157",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user