diff --git a/CHANGELOG.md b/CHANGELOG.md index cc67d5fd..a81ed108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - [#300](https://github.com/pusher/oauth2_proxy/pull/300) Added userinfo endpoint (@kbabuadze) - [#309](https://github.com/pusher/oauth2_proxy/pull/309) Added support for custom CA when connecting to Redis cache (@lleszczu) - [#248](https://github.com/pusher/oauth2_proxy/pull/248) Fix issue with X-Auth-Request-Redirect header being ignored (@webnard) +- [#314](https://github.com/pusher/oauth2_proxy/pull/314) Add redirect capability to sign_out (@costelmoraru) - [#265](https://github.com/pusher/oauth2_proxy/pull/265) Add upstream with static response (@cgroschupp) # v4.0.0 diff --git a/oauthproxy.go b/oauthproxy.go index d206aa64..61a94402 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -620,8 +620,14 @@ func (p *OAuthProxy) UserInfo(rw http.ResponseWriter, req *http.Request) { // SignOut sends a response to clear the authentication cookie func (p *OAuthProxy) SignOut(rw http.ResponseWriter, req *http.Request) { + redirect, err := p.GetRedirect(req) + if err != nil { + logger.Printf("Error obtaining redirect: %s", err.Error()) + p.ErrorPage(rw, 500, "Internal Error", err.Error()) + return + } p.ClearSessionCookie(rw, req) - http.Redirect(rw, req, "/", 302) + http.Redirect(rw, req, redirect, 302) } // OAuthStart starts the OAuth2 authentication flow