From 6614c863952132ee413264f649c906a9152841d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdinand=20M=C3=BCtsch?= Date: Sun, 24 May 2020 17:39:19 +0200 Subject: [PATCH] fix: base path for error redirects --- middlewares/authenticate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/middlewares/authenticate.go b/middlewares/authenticate.go index 4b7f3ab..d2461de 100644 --- a/middlewares/authenticate.go +++ b/middlewares/authenticate.go @@ -3,6 +3,7 @@ package middlewares import ( "context" "errors" + "fmt" "github.com/muety/wakapi/utils" "net/http" "strings" @@ -56,7 +57,7 @@ func (m *AuthenticateMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Reques w.WriteHeader(http.StatusUnauthorized) } else { utils.ClearCookie(w, models.AuthCookieKey) - http.Redirect(w, r, "/?error=unauthorized", http.StatusFound) + http.Redirect(w, r, fmt.Sprintf("%s/?error=unauthorized", m.config.BasePath), http.StatusFound) } return }