From 1faecbe1dd514272bd74ea2904a471d190a25039 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 8 May 2026 11:55:40 +0200 Subject: [PATCH] fix(frontend): anchor Vite dev proxy so /login.html isn't forwarded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /login proxy entry was matching any path starting with /login — including /login.html, which Vite is supposed to serve itself. Without the Go backend running, this caused ECONNREFUSED noise on every page load. Switched to regex patterns anchored with ^...$ so only the bare backend paths (/login, /logout, /getTwoFactorEnable) and explicit sub-routes (/panel/*, /server/*) get proxied. Static .html files Vite serves directly are no longer matched. Co-Authored-By: Claude Opus 4.7 --- frontend/vite.config.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 423cb4d8..00d9ac54 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -32,10 +32,11 @@ export default defineConfig({ strictPort: true, proxy: { // Proxy API calls during `npm run dev` to the local Go panel. - '/panel': 'http://localhost:2053', - '/server': 'http://localhost:2053', - '/login': 'http://localhost:2053', - '/logout': 'http://localhost:2053', + // Patterns are anchored regex so /login.html and /index.html + // (which Vite serves itself) are NOT forwarded — only the bare + // backend paths and their sub-routes. + '^/(login|logout|getTwoFactorEnable)$': 'http://localhost:2053', + '^/(panel|server)(/|$)': 'http://localhost:2053', }, }, });