From 78546056312ba5c9bea5b00b448e0b343263c566 Mon Sep 17 00:00:00 2001 From: ximenchuifeng Date: Fri, 26 Jun 2026 12:24:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(chart):=20agent-0/edge-0=20=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E6=97=A0=E9=99=90=E9=87=8D=E5=AE=9A=E5=90=91(webBaseP?= =?UTF-8?q?ath=20=E5=B0=BE=E6=96=9C=E6=9D=A0=E8=87=B4=E5=8F=8C=E6=96=9C?= =?UTF-8?q?=E6=9D=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drone→105 部署后访问 app.mixingx.local/agent-0/ 报 ERR_TOO_MANY_REDIRECTS。根因:values.yaml 的 webBasePath 带尾斜杠 (/agent-0/),_frontend.tpl 注入 VITE_BASE_PATH,agent/edge Dockerfile sed s|/__BASE__|...$VITE_BASE_PATH|g 配合 nginx.conf 本身已带的尾斜杠 (location /__BASE__/、return 302 /__BASE__/)→ 拼成 /agent-0//。渲染后的 location /agent-0// 匹配不到 /agent-0/(单斜杠)→ 落 location / → return 302 /agent-0// → try_files 在 alias 下找不到 → 死循环。 sso/ultra 不受影响(nginx.conf 硬编码 /sso/,不走 __BASE__ 占位符)。 双重修复: 1. values.yaml agent-0/edge-0 webBasePath 去尾斜杠(对齐 add-node.sh 约定) 2. monorepo agent/edge Dockerfile 加 BASE=${BASE%/} 兜底(已在 submodule 90657c0 推送),即使 values 误配带斜杠也不会再死循环 验证:sh 模拟 5 种 VITE_BASE_PATH 输入全部渲染单斜杠 location /agent-0/。 --- values.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/values.yaml b/values.yaml index 0a16ffd..da4b0f1 100644 --- a/values.yaml +++ b/values.yaml @@ -47,7 +47,11 @@ instances: role: agent webName: agent-web-0 # 前端服务名(显式,因为命名不统一:agent-web-0 / ultra-web) webImage: agent-web - webBasePath: /agent-0/ + # 注:webBasePath 不要带尾斜杠!Dockerfile 的 sed `s|/__BASE__|${VITE_BASE_PATH}|g` + # 配合 nginx.conf 的 `location /__BASE__/`(本身已带尾斜杠),再带尾斜杠会拼成 + # /agent-0//(双斜杠)→ 浏览器 ERR_TOO_MANY_REDIRECTS 死循环。 + # sso/ultra 不受影响(它们的 nginx.conf 用硬编码 /sso/,不走 __BASE__ 占位符)。 + webBasePath: /agent-0 serviceId: agent-0 database: agent-db-0 pgStorage: 5Gi @@ -59,7 +63,7 @@ instances: role: edge webName: edge-web-0 webImage: edge-web - webBasePath: /edge-0/ + webBasePath: /edge-0 # 不带尾斜杠(同上,见 agent-0 注释) serviceId: edge-0 database: edge-db-0 pgStorage: 5Gi @@ -67,12 +71,13 @@ instances: affinity: true # 加点位示例(取消注释 + helm upgrade 即生效): + # 注意:webBasePath 不能带尾斜杠,否则 Dockerfile sed 拼出双斜杠 → 重定向死循环 # - name: agent-beijing # image: agent # role: agent # webName: agent-web-beijing # webImage: agent-web - # webBasePath: /agent-beijing/ + # webBasePath: /agent-beijing # serviceId: agent-beijing # database: agent-db-beijing # pgStorage: 5Gi