Only use SameSite=None on Secure site

This fixes logging in when developing on newer versions of Chrome.
This commit is contained in:
Matt Baer 2021-04-30 11:03:42 -04:00
parent 2903c86875
commit 4565c6dd90
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ func (app *App) InitSession() {
MaxAge: sessionLength,
HttpOnly: true,
Secure: strings.HasPrefix(app.cfg.App.Host, "https://"),
SameSite: http.SameSiteNoneMode,
}
if store.Options.Secure {
store.Options.SameSite = http.SameSiteNoneMode
}
app.sessionStore = store
}