1.4.24:CORS 自動放行同實例 portal(不再依賴 UI_ORIGINS)+診斷端點+portal 導流文案

This commit is contained in:
2026-08-08 21:15:15 +08:00
parent 31a6ccf455
commit fc3c3cad06
3 changed files with 62 additions and 15 deletions
+3 -1
View File
@@ -14681,7 +14681,9 @@ app.use("*", cors({
extra = String(c.env.UI_ORIGINS || "").split(",").map((s) => s.trim()).filter(Boolean);
} catch {
}
return [...STATIC_ORIGINS, ...extra].includes(origin) ? origin : null;
const sub = String(c.env.WORKER_SUBDOMAIN || "").trim();
const sibling = sub ? [`https://arcrun-rag-ui.${sub}.workers.dev`] : [];
return [...STATIC_ORIGINS, ...sibling, ...extra].includes(origin) ? origin : null;
},
allowMethods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
allowHeaders: ["Content-Type", "Authorization", "X-Arcrun-API-Key"],