fix: proxy prod api traffic through web entry

This commit is contained in:
chengkml
2026-05-16 16:56:18 +08:00
parent 7eb29346c8
commit c96bb5fa2d
5 changed files with 79 additions and 5 deletions
+1
View File
@@ -73,6 +73,7 @@
- 认证请求与 WebSocket 连接均统一复用该运行时 API 基址解析逻辑。
- `NEXT_PUBLIC_API_BASE_URL` 必须只配置“协议 + 主机 + 可选端口”,不要额外带 `/api` 前缀;当前前端请求路径已自行拼接 `/api/v1/...`,若环境变量写成 `https://host/api` 会落成 `/api/api/v1/...`
- 通过 IP:3000 直接访问站点时,后端 `API_CORS_ORIGINS` 必须显式包含该页面 origin(例如 `http://223.109.142.84:3000`);仅放行正式域名会导致浏览器在登录预检阶段返回 `Disallowed CORS origin`
- 生产若通过公网 `IP:3000` 暴露前端,而公网 `8000` 不可直达,则应由入口反代统一承接:浏览器端对 loopback API 基址一律回落到当前站点 origin,`/api/*``/api/v1/ws` 通过部署层反代到 `api:8000`,避免浏览器直接访问 `host:8000`
## 前端构建稳定性口径(2026-04-13)