From a3023fec3945777ed8729404d99242fa5fc4d398 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Fri, 17 Apr 2026 23:20:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DHybrid=20HTTP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/admin/reverse/output/index-CO3BwsT2.pretty.js | 10 +++++++++- internal/handler/web_pages.go | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/admin/reverse/output/index-CO3BwsT2.pretty.js b/frontend/admin/reverse/output/index-CO3BwsT2.pretty.js index 5299acd..87d7adf 100644 --- a/frontend/admin/reverse/output/index-CO3BwsT2.pretty.js +++ b/frontend/admin/reverse/output/index-CO3BwsT2.pretty.js @@ -27258,7 +27258,15 @@ const LL = [ ]; const DL = FE.create({ baseURL: (function () { - const e = window.settings?.base_url || "/"; + let e = window.settings?.base_url || "/"; + if ( + "undefined" != typeof window && + "https:" === window.location?.protocol && + "string" == typeof e && + e.startsWith("http://") + ) { + e = "/"; + } return e.endsWith("/") ? e + "api/v2" : e + "/api/v2"; })(), timeout: 3e4, diff --git a/internal/handler/web_pages.go b/internal/handler/web_pages.go index f64b0ce..5229198 100644 --- a/internal/handler/web_pages.go +++ b/internal/handler/web_pages.go @@ -66,7 +66,9 @@ func AdminAppPage(c *gin.Context) { title := service.MustGetString("app_name", "XBoard") + " Admin" settings := map[string]string{ - "base_url": requestBaseURL(c), + // Keep admin API requests same-origin so reverse proxies and HTTPS termination + // don't depend on backend protocol/header inference. + "base_url": "", "title": title, "version": service.MustGetString("app_version", "1.0.0"), "logo": service.MustGetString("logo", ""),