File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
VeryNginx/lua_script/module Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2626
2727function _M .filter_ip ()
2828 if VeryNginxConfig .configs [" filter_ip_enable" ] ~= true then
29- return false ;
29+ return true
3030 end
3131
3232 local remote_addr = ngx .var .remote_addr
3333 for i , v in ipairs ( VeryNginxConfig .configs [' filter_ip_rule' ] ) do
3434 if v [1 ] == remote_addr then
35- return true
35+ return false
3636 end
3737 end
3838
39- return false
39+ return true
4040end
4141
4242function _M .filter_useragent ()
@@ -47,6 +47,10 @@ function _M.filter_useragent()
4747 local find = ngx .re .find
4848 local http_user_agent = ngx .var .http_user_agent
4949
50+ if http_user_agent == nil then
51+ return true
52+ end
53+
5054 for i , v in ipairs ( VeryNginxConfig .configs [" filter_useragent_rule" ] ) do
5155 if find ( http_user_agent , v [1 ], " is" ) then
5256 return false
@@ -108,7 +112,7 @@ function _M.filter()
108112 return
109113 end
110114
111- if _M .filter_ip () = = true then
115+ if _M .filter_ip () ~ = true then
112116 ngx .exit ( ngx .HTTP_SERVICE_UNAVAILABLE )
113117 end
114118
You can’t perform that action at this time.
0 commit comments