Use X-Auth-Request-Redirect request header in sign-in page
This is useful in Nginx auth_request mode, if a 401 handler is configured to redirect to the sign-in page. As the request URL does not reflect the actual URL, the value is taken from the header "X-Auth-Request-Redirect" instead. Based on #247
This commit is contained in:
parent
829b442302
commit
90a22b2f39
@ -363,6 +363,9 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
|
|||||||
rw.WriteHeader(code)
|
rw.WriteHeader(code)
|
||||||
|
|
||||||
redirect_url := req.URL.RequestURI()
|
redirect_url := req.URL.RequestURI()
|
||||||
|
if req.Header.Get("X-Auth-Request-Redirect") != "" {
|
||||||
|
redirect_url = req.Header.Get("X-Auth-Request-Redirect")
|
||||||
|
}
|
||||||
if redirect_url == p.SignInPath {
|
if redirect_url == p.SignInPath {
|
||||||
redirect_url = "/"
|
redirect_url = "/"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user