mirror of
https://github.com/potats0/lua-resty-coraza.git
synced 2025-06-28 17:41:00 +03:00
feat: 添加deny动作同样为block
This commit is contained in:
parent
ed1bc2b098
commit
c7055d1e99
@ -75,16 +75,9 @@ function _M.do_handle()
|
||||
-- Response which was disrupted doesn't make sense.
|
||||
if ngx_ctx.action ~= nil and ngx_ctx.transaction ~= nil then
|
||||
nlog(warn_fmt([[Transaction %s request: "%s" is interrupted by policy. Action is %s]], ngx_ctx.request_id, ngx_var.request, ngx_ctx.action))
|
||||
if ngx_ctx.action == "drop" then
|
||||
if ngx_ctx.action == "drop" or ngx_ctx.action == "deny" then
|
||||
ngx_ctx.is_disrupted = true
|
||||
return ngx_ctx.status_code, fmt(consts.BLOCK_CONTENT_FORMAT, ngx_ctx.status_code)
|
||||
-- TODO: disrupted by more action
|
||||
--elseif ngx_ctx.action == "deny" then
|
||||
-- ngx.status = ngx_ctx.status_code
|
||||
-- -- NYI: cannot call this C function (yet)
|
||||
-- -- ngx.header.content_type = consts.BLOCK_CONTENT_TYPE
|
||||
-- ngx.say(fmt(consts.BLOCK_CONTENT_FORMAT, ngx_ctx.status_code))
|
||||
-- return ngx.exit(ngx.status)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -106,13 +99,6 @@ function _M.do_interrupt()
|
||||
nlog(err_fmt(msg))
|
||||
end
|
||||
return ngx.exit(ngx.status)
|
||||
-- TODO: disrupted by more action
|
||||
-- elseif ngx_ctx.action == "deny" then
|
||||
-- ngx.status = ngx_ctx.status_code
|
||||
---- NYI: cannot call this C function (yet)
|
||||
---- ngx.header.content_type = consts.BLOCK_CONTENT_TYPE
|
||||
-- ngx.say(fmt(consts.BLOCK_CONTENT_FORMAT, ngx_ctx.status_code))
|
||||
-- eturn ngx.exit(ngx.status)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user