Skip to content

Commit

Permalink
modify block page
Browse files Browse the repository at this point in the history
  • Loading branch information
hevienz committed Jul 27, 2015
1 parent 8325dac commit 89d737e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ end

function dswaf_output()
ngx.status = ngx.HTTP_FORBIDDEN
ngx.say("You have been blocked by NGINX-LUA-DS-WAF.")
ngx.header.content_type = 'text/html'
ngx.say([[
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
</head>
<body style="width:100%;height:100%;background:#0066cc;">
<h1 style="color:#FFF;text-align:center;">You have been blocked by NGINX-LUA-DS-WAF.</h1>
</body>
</html>
]])
ngx.exit(ngx.HTTP_FORBIDDEN)
end
2 changes: 1 addition & 1 deletion waf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function dymanic_block_ip_module(mode)
red:expire(remote_addr, 60)
else
red:incr(remote_addr)
if tonumber(access_num) > tonumber(redis_get("DSWAF_DYMANIC_BLOCK_IPS_RATE", 10)) then
if tonumber(access_num) > tonumber(redis_get("DSWAF_DYMANIC_BLOCK_IPS_RATE", 1000)) then
log("DYMANIC_BLOCK_IP_MODULE", remote_addr .. "(" .. access_num .. ")")
if mode == "ENABLE" then dswaf_output() end
end
Expand Down

0 comments on commit 89d737e

Please sign in to comment.