From 134208d5102ae82bd36b5e8d819aacf88ce7afa0 Mon Sep 17 00:00:00 2001 From: "n72595987@gmail.com" Date: Sun, 30 Nov 2025 00:01:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF=20n?= =?UTF-8?q?ginx=20=E9=85=8D=E7=BD=AE=E5=92=8C=20API=20=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nginx.conf: 将后端代理地址从 martial-backend 改为 172.21.0.1:8123(宿主机网关) - .env.production: 移除 VITE_APP_API 的 /api 前缀 - 修复登录时 "No endpoint POST /api/blade-auth/oauth/token" 错误 - 修复容器启动失败 "host not found in upstream martial-backend" 错误 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- nginx.conf | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nginx.conf b/nginx.conf index 0daa0c9..887693e 100644 --- a/nginx.conf +++ b/nginx.conf @@ -15,28 +15,31 @@ server { try_files $uri $uri/ /index.html; } - # API 代理到后端 + # API 代理到后端(直接访问宿主机上的后端服务) location /api/ { - proxy_pass http://martial-backend:8123/api/; + proxy_pass http://172.21.0.1:8123/api/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } - - # BladeX 系统模块代理 + + # BladeX 认证模块代理 location /blade-auth/ { - proxy_pass http://martial-backend:8123/blade-auth/; + proxy_pass http://172.21.0.1:8123/blade-auth/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } - + + # BladeX 系统模块代理 location /blade-system/ { - proxy_pass http://martial-backend:8123/blade-system/; + proxy_pass http://172.21.0.1:8123/blade-system/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } # 缓存静态资源