git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #248 from VidAngel/support-x-auth-request-redirect

More fully support X-Auth-Request-Redirect header

commit721d28bd4fe974d675005d9d0fcd942fec591c32 authorJoel Speed <Joel.speed@hotmail.co.uk> dateMon 30 Sep 2019, 17:53 (7 years ago) parent44cdcc7ac0d010
3 files changed+8−1
CHANGELOG.md+2 docs/configuration/configuration.md+2 oauthproxy.go+4−1
CHANGELOG.md+2
@@ -6,6 +6,8 @@
66
77# v4.0.0
88
9+- [#248](https://github.com/pusher/oauth2_proxy/pull/248) Fix issue with X-Auth-Request-Redirect header being ignored
10+
911## Release Highlights
1012- Documentation is now on a [microsite](https://pusher.github.io/oauth2_proxy/)
1113- Health check logging can now be disabled for quieter logs
docs/configuration/configuration.md+2
@@ -249,6 +249,8 @@ server {
249249 proxy_set_header X-Real-IP $remote_addr;
250250 proxy_set_header X-Scheme $scheme;
251251 proxy_set_header X-Auth-Request-Redirect $request_uri;
252+ # or, if you are handling multiple domains:
253+ # proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
252254 }
253255 location = /oauth2/auth {
254256 proxy_pass http://127.0.0.1:4180;
oauthproxy.go+4−1
@@ -480,7 +480,10 @@ func (p *OAuthProxy) GetRedirect(req *http.Request) (redirect string, err error)
480480 return
481481 }
482482
483− redirect = req.Form.Get("rd")
483+ redirect = req.Header.Get("X-Auth-Request-Redirect")
484+ if req.Form.Get("rd") != "" {
485+ redirect = req.Form.Get("rd")
486+ }
484487 if !p.IsValidRedirect(redirect) {
485488 redirect = req.URL.Path
486489 if strings.HasPrefix(redirect, p.ProxyPrefix) {