Include URL query in login redirects (#3305)

This commit is contained in:
DingDongSoLong4
2023-01-09 02:13:42 +02:00
committed by GitHub
parent 01d40c1b9e
commit 639a9da65b
2 changed files with 10 additions and 5 deletions

View File

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