修复跨域

This commit is contained in:
qiyunfanbo126.com 2024-08-06 10:06:51 +08:00
parent 3b37b08e8b
commit 56561bcb3e
2 changed files with 1 additions and 2 deletions

View File

@ -191,7 +191,6 @@ func GetUserId(c *gin.Context) int {
} }
return 0 return 0
} }
} }
// GetUserCustNo 获取用户custNo // GetUserCustNo 获取用户custNo

View File

@ -44,7 +44,7 @@ func Auth() gin.HandlerFunc {
func Cors() gin.HandlerFunc { func Cors() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
c.Writer.Header().Set("Access-Control-Allow-Origin", "*") c.Writer.Header().Set("Access-Control-Allow-Origin", "milk.h5.cdlsxd.cn")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, platform,Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control,token, X-Requested-With") c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, platform,Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control,token, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE") c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE")