diff --git a/init.lua b/init.lua index 69913b7..200fee8 100644 --- a/init.lua +++ b/init.lua @@ -225,7 +225,7 @@ function whiteip() if next(ipWhitelist) ~= nil then clientIp = getClientIp() for _,ip in pairs(ipWhitelist) do - if ip == clientIp or string.find(clientIp, ip) then + if ip == clientIp or string.find(clientIp, ip) == 1 then return true end end @@ -237,7 +237,7 @@ function blockip() if next(ipBlocklist) ~= nil then clientIp = getClientIp() for _,ip in pairs(ipBlocklist) do - if ip == clientIp or string.find(clientIp, ip) then + if ip == clientIp or string.find(clientIp, ip) == 1 then ngx.exit(403) return true end