From 717f97f0201711bd15b651ec9bc6a2ad52862b53 Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 10 Feb 2026 19:39:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=89=8D=E7=AB=AF=20?= =?UTF-8?q?Docker=20=E6=89=93=E5=8C=85=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/.env.production | 3 ++- src/frontend/nginx.conf | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frontend/.env.production b/src/frontend/.env.production index 03dcf6d..bc00c9e 100644 --- a/src/frontend/.env.production +++ b/src/frontend/.env.production @@ -1,2 +1,3 @@ # API 地址配置 -VITE_API_BASE_URL=https://app.zpc-xy.com/corps/api/api/admin +# 使用 Nginx 代理,直接用相对路径 +VITE_API_BASE_URL=/api diff --git a/src/frontend/nginx.conf b/src/frontend/nginx.conf index f1974ae..dd4c7c0 100644 --- a/src/frontend/nginx.conf +++ b/src/frontend/nginx.conf @@ -10,6 +10,15 @@ server { try_files $uri $uri/ /index.html; } + # API 代理 + location /api/ { + proxy_pass http://corps-admin-api:8080; + 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; + } + # 缓存静态资源 location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y;