git.iko.soy/typeable/oauth2-proxy
on master help sign in
more robust ClearSessionCookie()

default domain changed from request Host to blank, recently try to clear cookies for both

commit74d0fbc8685200a14599b29074e8b2acd799d753 authorPierce Lopez <pierce.lopez@gmail.com> dateTue 12 Dec 2017, 19:14 (9 years ago) parentd75f626
1 file changed+9−1
oauthproxy.go+9−1
oauthproxy.go+9−1
@@ -300,7 +300,15 @@ func (p *OAuthProxy) SetCSRFCookie(rw http.ResponseWriter, req *http.Request, va
300300}
301301
302302func (p *OAuthProxy) ClearSessionCookie(rw http.ResponseWriter, req *http.Request) {
303− http.SetCookie(rw, p.MakeSessionCookie(req, "", time.Hour*-1, time.Now()))
303+ clr := p.MakeSessionCookie(req, "", time.Hour*-1, time.Now())
304+ http.SetCookie(rw, clr)
305+
306+ // ugly hack because default domain changed
307+ if p.CookieDomain == "" {
308+ clr2 := *clr
309+ clr2.Domain = req.Host
310+ http.SetCookie(rw, &clr2)
311+ }
304312}
305313
306314func (p *OAuthProxy) SetSessionCookie(rw http.ResponseWriter, req *http.Request, val string) {