feat: Add proxy to frontend dev server to fix CORS issues
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
NODE_ENV=development
|
||||
|
||||
# API 基础地址
|
||||
VITE_API_BASE_URL=http://localhost:5409
|
||||
VITE_API_BASE_URL=/api
|
||||
|
||||
# 应用端口
|
||||
VITE_PORT=5173
|
||||
|
||||
@@ -19,7 +19,14 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
open: true
|
||||
open: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:5409',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
}
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
|
||||
Reference in New Issue
Block a user