修复浏览器cookie不识别

This commit is contained in:
hoteas
2021-07-21 00:09:13 +08:00
parent d736a74198
commit 9cd7ad34b3
3 changed files with 8 additions and 2 deletions
+3 -1
View File
@@ -298,7 +298,9 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
if len(token) == 32 {
sessionId = token
}
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
//http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId+";SameSite=Strict", Path: "/"})
//http.SetCookie(w, &http.Cookie{Name: "SameSite", Value: "Strict", Path: "/"})
w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure")
} else {
sessionId = cookie.Value
}