From e01d52b771518ed837b0c40492ef8b8f5bbf9ce7 Mon Sep 17 00:00:00 2001 From: ShadowWalker Date: Sat, 11 Dec 2021 00:27:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=A5=E6=A0=BC=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E6=A8=A1=E5=BC=8F=E6=8B=A6=E6=88=AA=E4=BA=86=E5=81=A5?= =?UTF-8?q?=E5=BA=B7=E6=A3=80=E6=9F=A5=E5=AF=BC=E8=87=B4=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91=E5=A4=B1=E6=95=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/middleware/cors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/cors.go b/server/middleware/cors.go index fa1c6e2f..99664b7e 100644 --- a/server/middleware/cors.go +++ b/server/middleware/cors.go @@ -48,7 +48,7 @@ func CorsByRules() gin.HandlerFunc { } // 严格白名单模式且未通过检查,直接拒绝处理请求 - if whitelist == nil && global.GVA_CONFIG.Cors.Mode == "strict-whitelist" { + if whitelist == nil && global.GVA_CONFIG.Cors.Mode == "strict-whitelist" && !(c.Request.Method == "GET" && c.Request.URL.Path == "/health") { c.AbortWithStatus(http.StatusForbidden) } else { // 非严格白名单模式,无论是否通过检查均放行所有 OPTIONS 方法