作者 tangxvhui

跨域

@@ -15,7 +15,7 @@ func AllowCors() func(ctx *context.Context) { @@ -15,7 +15,7 @@ func AllowCors() func(ctx *context.Context) {
15 //指的是允许的Header的种类 15 //指的是允许的Header的种类
16 AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Content-Type", "x-requested-with"}, 16 AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Content-Type", "x-requested-with"},
17 //公开的HTTP标头列表 17 //公开的HTTP标头列表
18 - ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, 18 + ExposeHeaders: []string{"Content-Length"},
19 //如果设置,则允许共享身份验证凭据,例如cookie 19 //如果设置,则允许共享身份验证凭据,例如cookie
20 AllowCredentials: true, 20 AllowCredentials: true,
21 }) 21 })