修复了些问题

pull/107/head
大力丸666 2024-12-20 22:31:55 +08:00
parent 9085a70807
commit 06b4c2b699
2 changed files with 8 additions and 7 deletions

View File

@ -24,7 +24,7 @@ if not requestCount then
else
-- 如果标志已经为2则IP处于封禁状态直接拦截
if flag == 2 then
return waf.block(true) -- 阻断请求返回403响应
return waf.block(true) -- 阻断请求
end
-- 增加非法请求次数

View File

@ -2,12 +2,13 @@
:
: HTTP
:
: 40x50x60101440
: 40040140340440542944460101440
--]]
local function isCommonError(status)
-- 检查是否为40x或50x错误
return status >= 400 and status < 600
local function isSpecifiedError(status)
-- 检查是否为指定的状态码,限定在 [400, 401, 403, 404, 405, 429, 444]
local allowed_errors = {400, 401, 403, 404, 405, 429, 444}
return waf.inArray(status, allowed_errors)
end
-- 配置参数
@ -21,8 +22,8 @@ local ip = waf.ip
-- 获取返回的HTTP状态码
local status = waf.status
-- 检查当前请求是否是40x或者50x错误不是则直接返回false
if not isCommonError(status) then
-- 检查当前请求是否是指定的状态码错误不是则直接返回false
if not isSpecifiedError(status) then
return false
end