fix(server): set default app cookie to lax mode
This commit is contained in:
parent
536fd87c3c
commit
b1bc7b5370
|
@ -29,10 +29,16 @@ func SetSession(gc *gin.Context, sessionID string) {
|
|||
domain = "." + domain
|
||||
}
|
||||
|
||||
// Use sameSite = lax by default
|
||||
// For more information check:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
||||
// https://github.com/gin-gonic/gin/blob/master/context.go#L86
|
||||
// TODO add ability to sameSite = none / strict from dashboard
|
||||
gc.SetSameSite(http.SameSiteLaxMode)
|
||||
|
||||
// TODO allow configuring from dashboard
|
||||
year := 60 * 60 * 24 * 365
|
||||
|
||||
gc.SetSameSite(http.SameSiteNoneMode)
|
||||
gc.SetCookie(constants.AppCookieName+"_session", sessionID, year, "/", host, secure, httpOnly)
|
||||
gc.SetCookie(constants.AppCookieName+"_session_domain", sessionID, year, "/", domain, secure, httpOnly)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user