修改前端代理错误
This commit is contained in:
@@ -228,7 +228,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
// API代理转发到后端服务器
|
// API代理转发到后端服务器
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:3000',
|
target: 'http://localhost:8000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||||
@@ -267,7 +267,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
// 媒体文件代理转发到后端服务器
|
// 媒体文件代理转发到后端服务器
|
||||||
'/media': {
|
'/media': {
|
||||||
target: 'http://localhost:3000',
|
target: 'http://localhost:8000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
rewrite: (path) => path.replace(/^\/media/, '/media'),
|
rewrite: (path) => path.replace(/^\/media/, '/media'),
|
||||||
@@ -308,7 +308,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
// 环境变量定义,确保在没有.env文件时也能正常工作
|
// 环境变量定义,确保在没有.env文件时也能正常工作
|
||||||
__VITE_API_BASE_URL__: JSON.stringify('http://localhost:3000/api'),
|
__VITE_API_BASE_URL__: JSON.stringify('http://localhost:8000/api'),
|
||||||
__VITE_APP_TITLE__: JSON.stringify('Hertz Admin'),
|
__VITE_APP_TITLE__: JSON.stringify('Hertz Admin'),
|
||||||
__VITE_APP_VERSION__: JSON.stringify('1.0.0'),
|
__VITE_APP_VERSION__: JSON.stringify('1.0.0'),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user