Skip to content

Commit b1bc7b5

Browse files
committed
fix(server): set default app cookie to lax mode
1 parent 536fd87 commit b1bc7b5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/cookie/cookie.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ func SetSession(gc *gin.Context, sessionID string) {
2929
domain = "." + domain
3030
}
3131

32+
// Use sameSite = lax by default
33+
// For more information check:
34+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
35+
// https://github.com/gin-gonic/gin/blob/master/context.go#L86
36+
// TODO add ability to sameSite = none / strict from dashboard
37+
gc.SetSameSite(http.SameSiteLaxMode)
38+
3239
// TODO allow configuring from dashboard
3340
year := 60 * 60 * 24 * 365
3441

35-
gc.SetSameSite(http.SameSiteNoneMode)
3642
gc.SetCookie(constants.AppCookieName+"_session", sessionID, year, "/", host, secure, httpOnly)
3743
gc.SetCookie(constants.AppCookieName+"_session_domain", sessionID, year, "/", domain, secure, httpOnly)
3844
}

0 commit comments

Comments
 (0)