From cd17bcff279594636d7a550a6192b80cd32dae00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A1=BE=E9=9B=A8=E6=99=A8?= Date: Sat, 23 May 2026 02:15:19 +0800 Subject: [PATCH] fix: remove server-side path redirect to prevent CDN-cached redirect loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The server-side MapFrontendPath redirect was causing infinite redirect loops when CDN (Cloudflare) cached 302 responses for different themes: - User A (theme=default) visits /console → 302 → /dashboard (cached) - User B (theme=classic) visits /dashboard → 302 → /console (cached) - Any user hits /console → cached 302 → /dashboard → cached 302 → /console → loop Fix: Remove the server-side redirect entirely. Instead, always serve the correct theme's index.html for any SPA route. The frontend router will handle navigation to the correct page within its own theme. --- router/web-router.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/router/web-router.go b/router/web-router.go index 17027316f77..804a357d694 100644 --- a/router/web-router.go +++ b/router/web-router.go @@ -38,13 +38,6 @@ func SetWebRouter(router *gin.Engine, assets ThemeAssets) { } theme := resolveFrontendTheme(c) - if redirectPath := common.MapFrontendPath(theme, c.Request.URL.Path); redirectPath != "" && redirectPath != c.Request.URL.Path { - if c.Request.URL.RawQuery != "" { - redirectPath = redirectPath + "?" + c.Request.URL.RawQuery - } - c.Redirect(http.StatusFound, redirectPath) - return - } themeFS := selectFrontendFS(theme, defaultFS, classicFS) requestPath := strings.TrimPrefix(c.Request.URL.Path, "/") if requestPath != "" && themeFS.Exists("/", requestPath) {