diff --git a/main.go b/main.go index 2359666..8f2b5d0 100644 --- a/main.go +++ b/main.go @@ -130,6 +130,7 @@ func main() { cookieStore = sessions.NewCookieStore([]byte(mainCfg.Cookie.AuthKey)) + http.HandleFunc("/", handleRootRequest) http.HandleFunc("/auth", handleAuthRequest) http.HandleFunc("/login", handleLoginRequest) http.HandleFunc("/logout", handleLogoutRequest) @@ -155,6 +156,11 @@ func main() { } } +func handleRootRequest(res http.ResponseWriter, r *http.Request) { + // In case of a request to `/` redirect to login utilizing the default redirect + http.Redirect(res, r, "login", http.StatusFound) +} + func handleAuthRequest(res http.ResponseWriter, r *http.Request) { user, groups, err := detectUser(res, r)