Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 90a22b2

Browse files
sjoerdmulderashkulz
authored andcommitted
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
1 parent 829b442 commit 90a22b2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

oauthproxy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
363363
rw.WriteHeader(code)
364364

365365
redirect_url := req.URL.RequestURI()
366+
if req.Header.Get("X-Auth-Request-Redirect") != "" {
367+
redirect_url = req.Header.Get("X-Auth-Request-Redirect")
368+
}
366369
if redirect_url == p.SignInPath {
367370
redirect_url = "/"
368371
}

0 commit comments

Comments
 (0)