git.iko.soy/typeable/oauth2-proxy
on master help sign in
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

commit90a22b2f39a31af37c8d8e7f7c47f475e0d70933 authorSjoerd Mulder <sjoerdmulder@gmail.com> dateWed 16 Nov 2016, 12:06 (10 years ago) parent829b442
1 file changed+3
oauthproxy.go+3
oauthproxy.go+3
@@ -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 }