如果管理系统前端有反向代理,则不要自动从HTTP跳转到HTTPS

This commit is contained in:
GoEdgeLab
2023-05-07 09:28:18 +08:00
parent 1194a829f3
commit 19653b115c

View File

@@ -50,8 +50,11 @@ func (this *IndexAction) RunGet(params struct {
newHost += ":" + types.String(httpsPort)
}
this.RedirectURL("https://" + newHost + this.Request.RequestURI)
return
// 如果没有前端反向代理,则跳转
if len(this.Request.Header.Get("X-Forwarded-For")) == 0 && len(this.Request.Header.Get("X-Real-Ip")) == 0 {
this.RedirectURL("https://" + newHost + this.Request.RequestURI)
return
}
}
}