From 6855d0dc3916fcc8cf7b888df199a82345f8da6c Mon Sep 17 00:00:00 2001 From: JustSong Date: Sat, 17 Jun 2023 15:30:14 +0800 Subject: [PATCH] chore: add x-requested-with header in CORS setting --- middleware/cors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/cors.go b/middleware/cors.go index 0197ef02..d5a5ed71 100644 --- a/middleware/cors.go +++ b/middleware/cors.go @@ -10,6 +10,6 @@ func CORS() gin.HandlerFunc { config.AllowAllOrigins = true config.AllowCredentials = true config.AllowMethods = []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"} - config.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type", "Authorization", "Accept", "Connection"} + config.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type", "Authorization", "Accept", "Connection", "x-requested-with"} return cors.New(config) }