From ff2fc24438b12d752e8d892a20d6679c168b4d21 Mon Sep 17 00:00:00 2001 From: soxft Date: Thu, 9 Jun 2022 19:43:43 +0800 Subject: [PATCH 1/2] fix: header --- app/middleware/cors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/middleware/cors.go b/app/middleware/cors.go index 0f5dd5a..866f988 100644 --- a/app/middleware/cors.go +++ b/app/middleware/cors.go @@ -8,10 +8,10 @@ import ( func Cors() gin.HandlerFunc { return func(c *gin.Context) { c.Header("Access-Control-Allow-Origin", config.Web.Cors) - c.Header("Server", "busuanzi-by-xcsoft/2.4") + c.Header("Server", "busuanzi-by-xcsoft/2.6") if c.Request.Method == "OPTIONS" { c.Header("Access-Control-Allow-Methods", "GET,POST,HEAD,OPTIONS") - c.Header("Access-Control-Allow-Headers", "x-bsz-referer") + c.Header("Access-Control-Allow-Headers", "x-bsz-referer, Authorization") c.Header("Access-Control-Max-Age", "86400") c.AbortWithStatus(204) return From 60a62fa564ef6b9dd7f60fa2733ac883208e0527 Mon Sep 17 00:00:00 2001 From: soxft Date: Thu, 9 Jun 2022 19:50:08 +0800 Subject: [PATCH 2/2] style --- app/middleware/cors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/middleware/cors.go b/app/middleware/cors.go index 866f988..db4d8c8 100644 --- a/app/middleware/cors.go +++ b/app/middleware/cors.go @@ -10,7 +10,7 @@ func Cors() gin.HandlerFunc { c.Header("Access-Control-Allow-Origin", config.Web.Cors) c.Header("Server", "busuanzi-by-xcsoft/2.6") if c.Request.Method == "OPTIONS" { - c.Header("Access-Control-Allow-Methods", "GET,POST,HEAD,OPTIONS") + c.Header("Access-Control-Allow-Methods", "GET, POST, HEAD, OPTIONS") c.Header("Access-Control-Allow-Headers", "x-bsz-referer, Authorization") c.Header("Access-Control-Max-Age", "86400") c.AbortWithStatus(204)