Explorar el Código

add more allow header

Paul hace 5 años
padre
commit
ec6a34b89f
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2
    1
      middleware/cors/cors.go

+ 2
- 1
middleware/cors/cors.go Ver fichero

12
 	config := cors.DefaultConfig()
12
 	config := cors.DefaultConfig()
13
 
13
 
14
 	config.AddAllowMethods(http.MethodDelete, http.MethodOptions, http.MethodPatch)
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
 	config.AllowCredentials = true
17
 	config.AllowCredentials = true
17
 	config.AllowOriginFunc = func(origin string) bool {
18
 	config.AllowOriginFunc = func(origin string) bool {
18
 		if gin.Mode() == gin.DebugMode {
19
 		if gin.Mode() == gin.DebugMode {