From 3cce95da4547f76b3434c56985c8c062f7e67f32 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 17 Apr 2024 15:26:33 +0800 Subject: [PATCH] =?UTF-8?q?UA=E5=90=8D=E5=8D=95=E6=94=AF=E6=8C=81=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=94=AE=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_user_agent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/nodes/http_request_user_agent.go b/internal/nodes/http_request_user_agent.go index 9890f84..c607bc0 100644 --- a/internal/nodes/http_request_user_agent.go +++ b/internal/nodes/http_request_user_agent.go @@ -13,7 +13,7 @@ func (this *HTTPRequest) doCheckUserAgent() (shouldStop bool) { const cacheSeconds = "3600" // 时间不能过长,防止修改设置后长期无法生效 - if !this.web.UserAgent.AllowRequest(this.RawReq) { + if this.web.UserAgent.MatchURL(this.URL()) && !this.web.UserAgent.AllowRequest(this.RawReq) { this.tags = append(this.tags, "userAgentCheck") this.writer.Header().Set("Cache-Control", "max-age="+cacheSeconds) this.writeCode(http.StatusForbidden, "The User-Agent has been blocked.", "当前访问已被UA名单拦截。")