Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 74d0fbc

Browse files
committed
more robust ClearSessionCookie()
default domain changed from request Host to blank, recently try to clear cookies for both
1 parent d75f626 commit 74d0fbc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

oauthproxy.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,15 @@ func (p *OAuthProxy) SetCSRFCookie(rw http.ResponseWriter, req *http.Request, va
300300
}
301301

302302
func (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

306314
func (p *OAuthProxy) SetSessionCookie(rw http.ResponseWriter, req *http.Request, val string) {

0 commit comments

Comments
 (0)