1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: base path for error redirects

This commit is contained in:
Ferdinand Mütsch 2020-05-24 17:39:19 +02:00
parent fad91725b0
commit 6614c86395

View File

@ -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
}