Fix authentication when using a reverse proxy with subpath prefix (#1818)

* Fix authentication when using a reverse proxy with subpath prefix
This commit is contained in:
InfiniteTF
2021-10-09 08:32:43 +02:00
committed by GitHub
parent 47ae1be53c
commit fb5f9162d0
4 changed files with 29 additions and 17 deletions

View File

@@ -83,12 +83,14 @@ func authenticateHandler() func(http.Handler) http.Handler {
return
}
prefix := getProxyPrefix(r.Header)
// otherwise redirect to the login page
u := url.URL{
Path: "/login",
Path: prefix + "/login",
}
q := u.Query()
q.Set(returnURLParam, r.URL.Path)
q.Set(returnURLParam, prefix+r.URL.Path)
u.RawQuery = q.Encode()
http.Redirect(w, r, u.String(), http.StatusFound)
return