aboutsummaryrefslogtreecommitdiffstats
path: root/web/web.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/web.go')
-rw-r--r--web/web.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/web/web.go b/web/web.go
index 11a5831..6c8e632 100644
--- a/web/web.go
+++ b/web/web.go
@@ -223,8 +223,14 @@ func NewRouter(cfg *config.Settings) http.Handler {
mux.Handle("/static/", GzipMiddleware(http.StripPrefix("/static/", http.FileServer(http.FS(staticSub)))))
// New Frontend (React/Vite) from web/dist/v2
+ // Default route
+ mux.Handle("/", GzipMiddleware(http.HandlerFunc(ServeFrontend)))
+ // Also keep /v2/ for explicit access
mux.Handle("/v2/", GzipMiddleware(http.StripPrefix("/v2/", http.HandlerFunc(ServeFrontend))))
+ // Legacy UI at /v1/
+ mux.Handle("/v1/", GzipMiddleware(http.StripPrefix("/v1/", AuthWrap(http.HandlerFunc(indexHandler)))))
+
// New REST API
apiServer := api.NewServer(cfg)
// We need to mount the raw mux from apiServer if we want /api/ access,
@@ -257,7 +263,7 @@ func NewRouter(cfg *config.Settings) http.Handler {
mux.HandleFunc("/api/logout", apiLogoutHandler)
mux.HandleFunc("/api/auth", apiAuthStatusHandler)
- mux.Handle("/", GzipMiddleware(AuthWrap(http.HandlerFunc(indexHandler))))
+ // Removed default root handler for legacy UI
return SecurityHeadersMiddleware(CSRFMiddleware(mux))
}