fix: 修复前端 nginx 配置和 API 基础路径
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- 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 <noreply@anthropic.com>
This commit is contained in:
23
nginx.conf
23
nginx.conf
@@ -15,9 +15,18 @@ 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 认证模块代理
|
||||
location /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;
|
||||
@@ -25,18 +34,12 @@ server {
|
||||
}
|
||||
|
||||
# BladeX 系统模块代理
|
||||
location /blade-auth/ {
|
||||
proxy_pass http://martial-backend: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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
# 缓存静态资源
|
||||
|
||||
Reference in New Issue
Block a user