修复浏览器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

View File

@ -298,7 +298,9 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
if len(token) == 32 { if len(token) == 32 {
sessionId = token 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 { } else {
sessionId = cookie.Value sessionId = cookie.Value
} }

View File

@ -14,7 +14,7 @@
"mysql": { "mysql": {
"host": "192.168.6.253", "host": "192.168.6.253",
"name": "hotimego", "name": "hotimego",
"password": "root", "password": "dasda8454456",
"port": "3306", "port": "3306",
"prefix": "", "prefix": "",
"user": "root" "user": "root"

View File

@ -20,6 +20,10 @@
}, },
"注释": "可配置memorydbredis默认启用memory默认优先级为memory\u003eredis\u003edb,memory与数据库缓存设置项一致缓存数据填充会自动反方向反哺加入memory缓存过期将自动从redis更新但memory永远不会更新redis如果是集群建议不要开启memory配置即启用" "注释": "可配置memorydbredis默认启用memory默认优先级为memory\u003eredis\u003edb,memory与数据库缓存设置项一致缓存数据填充会自动反方向反哺加入memory缓存过期将自动从redis更新但memory永远不会更新redis如果是集群建议不要开启memory配置即启用"
}, },
"codeConfig": {
"packageName": "默认无必须包名称以及应用名生成代码的配置文件地址比如config/app.json数据库有更新时自动更新配置文件以及对应的生成文件",
"注释": "配置即启用,非必须,默认无"
},
"crossDomain": "默认空 非必须空字符串为不开启如果需要跨域设置auto为智能开启所有网站允许跨域http://www.baidu.com为指定域允许跨域", "crossDomain": "默认空 非必须空字符串为不开启如果需要跨域设置auto为智能开启所有网站允许跨域http://www.baidu.com为指定域允许跨域",
"db": { "db": {
"mysql": { "mysql": {