fix(deploy): 更新API代理配置以匹配容器网络

将nginx和vite配置中的API代理地址统一为容器网络中的地址,确保开发和生产环境的一致性
This commit is contained in:
Wenjie Zhang 2025-11-14 11:00:57 +08:00
parent 3e6b3b2b6e
commit 15acdaac73
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ server {
}
location /api/ {
proxy_pass http://api:8000/;
proxy_pass http://api:5050/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@ -14,7 +14,7 @@ export default defineConfig(({ mode }) => {
server: {
proxy: {
'^/api': {
target: env.VITE_API_URL || 'http://127.0.0.1:5050',
target: env.VITE_API_URL || 'http://api:5050',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api')
}