diff --git a/internal/server/routes.go b/internal/server/routes.go index c16f80d..043990c 100644 --- a/internal/server/routes.go +++ b/internal/server/routes.go @@ -8,10 +8,11 @@ import ( func addBaseMiddleware(app *RatchetApp, next http.Handler, requireAuth bool) http.Handler { var h http.Handler + h = next if requireAuth { - h = RequireAuthenticationMiddleware(next, app.sessionManager) + h = RequireAuthenticationMiddleware(h, app.sessionManager) } - h = AuthenticateMiddleware(next, app.sessionManager, app.userService) + h = AuthenticateMiddleware(h, app.sessionManager, app.userService) h = NoSurfMiddleware(h) h = app.sessionManager.LoadAndSave(h) return h