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

Commit 1209c63

Browse files
authored
Merge pull request #510 from ploxiln/clear_invalid_session
more robust ClearSessionCookie()
2 parents 1a82180 + 74d0fbc commit 1209c63

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

oauthproxy.go

Lines changed: 9 additions & 1 deletion
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)