Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Use X-Auth-Request-Redirect request header in sign-in page
Browse files Browse the repository at this point in the history
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 bitly#247
  • Loading branch information
sjoerdmulder authored and fschaefer committed Nov 25, 2016
1 parent 1fd0bc7 commit 167267f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
rw.WriteHeader(code)

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 {
redirect_url = "/"
}
Expand Down

0 comments on commit 167267f

Please sign in to comment.