oms/frontend/.env.production
liufumingren 122eb9ccc9 feat(frontend): 生产改为同源 /api,前端挂到后端域名的根目录
- frontend/.env.production: VITE_API_BASE_URL 由 https://api.oms.gztbyc.com/api 改为 /api
- tools/DEPLOY.md: 新增单站点 Nginx 配置(root=current、/api/ include upstream、SPA try_files 回退),
  域名/CORS 章节改为同源说明
- tools/config/deploy.config.example.cjs: Nginx 前置说明同步为单站点

同源后不再需要 CORS,后端切换 v1/v2 端口时前端产物无需重新构建。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-30 23:13:44 +08:00

12 lines
602 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 生产环境后端 API 地址(单站点部署:前端静态与 API 同源)
#
# 站点 oms.gztbyc.com 根目录指向前端 current,/api/ 由 Nginx 反代到 egg,
# 因此这里用相对路径 /api,请求始终同源:
# - 不产生跨域(无需 CORS 白名单)
# - 不会出现 HTTPS 页面调 HTTP 接口的「混合内容(Mixed Content)」问题
# - 后端切换 v1/v2 端口时前端无需重新构建
#
# 要求:Nginx 站点配置把 /api/ 反代到后端(可 include nginx-upstream.conf),
# 参考 tools/DEPLOY.md「单站点部署」。
VITE_API_BASE_URL=/api