From 032c07beefca3b6fe016753559059b4b76ca949e Mon Sep 17 00:00:00 2001 From: cclohmar Date: Mon, 6 Jul 2026 09:08:25 +0100 Subject: [PATCH] fix(proxy): auth middleware only for exact /, unmatched paths get greeting - Move combinedAuth inside the launcher handler path check - Unmatched proxy paths (not exactly /) now correctly serve NotFoundHandler greeting - Root / remains auth-gated as intended --- src/main.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main.go b/src/main.go index 11426ab..18644a6 100644 --- a/src/main.go +++ b/src/main.go @@ -198,15 +198,18 @@ func main() { }) // --- Proxy routes (all traffic through proxy as catch-all) --- - // Launcher dashboard (auth-gated) - launcherHandler := combinedAuth(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Launcher dashboard: auth only for exact "/", unmatched paths get NotFoundHandler + launcherHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { - // Not the root path — let proxy's NotFoundHandler handle it + // Not the root path — let proxy's NotFoundHandler handle it (no auth needed) prx.NotFoundHandler.ServeHTTP(w, r) return } - uiHandler.ServeHTTP(w, r) - })) + // Only apply auth for the actual dashboard root + combinedAuth(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + uiHandler.ServeHTTP(w, r) + })).ServeHTTP(w, r) + }) // Admin routes use a sub-mux with no-op auth (auth is applied at proxy route level) adminMux := http.NewServeMux()