mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 10:00:25 +08:00
UA名单支持批量添加关键词
This commit is contained in:
@@ -13,7 +13,7 @@ func (this *HTTPRequest) doCheckUserAgent() (shouldStop bool) {
|
|||||||
|
|
||||||
const cacheSeconds = "3600" // 时间不能过长,防止修改设置后长期无法生效
|
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.tags = append(this.tags, "userAgentCheck")
|
||||||
this.writer.Header().Set("Cache-Control", "max-age="+cacheSeconds)
|
this.writer.Header().Set("Cache-Control", "max-age="+cacheSeconds)
|
||||||
this.writeCode(http.StatusForbidden, "The User-Agent has been blocked.", "当前访问已被UA名单拦截。")
|
this.writeCode(http.StatusForbidden, "The User-Agent has been blocked.", "当前访问已被UA名单拦截。")
|
||||||
|
|||||||
Reference in New Issue
Block a user