@@ -620,8 +620,14 @@ func (p *OAuthProxy) UserInfo(rw http.ResponseWriter, req *http.Request) {
620620
621621// SignOut sends a response to clear the authentication cookie
622622func (p *OAuthProxy) SignOut(rw http.ResponseWriter, req *http.Request) {
623+ redirect, err := p.GetRedirect(req)
624+ if err != nil {
625+ logger.Printf("Error obtaining redirect: %s", err.Error())
626+ p.ErrorPage(rw, 500, "Internal Error", err.Error())
627+ return
628+ }
623629 p.ClearSessionCookie(rw, req)
624− http.Redirect(rw, req, "/", 302)
630+ http.Redirect(rw, req, redirect, 302)
625631}
626632
627633// OAuthStart starts the OAuth2 authentication flow