优化系统
This commit is contained in:
+8
-8
@@ -310,12 +310,12 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
//session也没有则判断是否创建cookie
|
||||
} else {
|
||||
//跨域不再通过cookie校验
|
||||
//if that.Config.GetString("crossDomain") == "" {
|
||||
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
|
||||
//} else {
|
||||
// //跨域允许需要设置cookie的允许跨域https才有效果
|
||||
// w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; Path=/; SameSite=None; Secure")
|
||||
//}
|
||||
if that.Config.GetString("crossDomain") == "" {
|
||||
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
|
||||
} else {
|
||||
//跨域允许需要设置cookie的允许跨域https才有效果
|
||||
w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; Path=/; SameSite=None; Secure")
|
||||
}
|
||||
}
|
||||
|
||||
unescapeUrl, err := url.QueryUnescape(req.RequestURI)
|
||||
@@ -436,7 +436,7 @@ func (that *Application) crossDomain(context *Context) {
|
||||
|
||||
//不跨域,则不设置
|
||||
remoteHost := context.Req.Host
|
||||
if context.Config.GetString("port") != "80" && context.Config.GetString("port") != "443" {
|
||||
if context.Config.GetString("port") == "80" || context.Config.GetString("port") == "443" {
|
||||
remoteHost = remoteHost + ":" + context.Config.GetString("port")
|
||||
}
|
||||
if context.Config.GetString("crossDomain") != "auto" {
|
||||
@@ -466,7 +466,7 @@ func (that *Application) crossDomain(context *Context) {
|
||||
|
||||
if origin != "" {
|
||||
header.Set("Access-Control-Allow-Origin", origin)
|
||||
return
|
||||
//return
|
||||
}
|
||||
|
||||
if refer != "" {
|
||||
|
||||
Reference in New Issue
Block a user