fix(chart): agent-0/edge-0 前端无限重定向(webBasePath 尾斜杠致双斜杠)

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/。
This commit is contained in:
ximenchuifeng committed 2026-06-26 12:24:54 +08:00
1 parent 38e0275d81
commit 7854605631
1 file changed
+8 -3
+8 -3
View File
@@ -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