瀏覽代碼

add more allow header

Paul 5 年之前
父節點
當前提交
ec6a34b89f
共有 1 個檔案被更改,包括 2 行新增1 行删除
  1. 2
    1
      middleware/cors/cors.go

+ 2
- 1
middleware/cors/cors.go 查看文件

@@ -12,7 +12,8 @@ func Cors() gin.HandlerFunc {
12 12
 	config := cors.DefaultConfig()
13 13
 
14 14
 	config.AddAllowMethods(http.MethodDelete, http.MethodOptions, http.MethodPatch)
15
-	config.AddAllowHeaders("Authorization", "X-Require-Cookie", "X-Device")
15
+	// x-requested-with antd上传组件需要
16
+	config.AddAllowHeaders("Authorization", "X-Require-Cookie", "X-Device", "x-requested-with")
16 17
 	config.AllowCredentials = true
17 18
 	config.AllowOriginFunc = func(origin string) bool {
18 19
 		if gin.Mode() == gin.DebugMode {