From e07cb445ac05d1f00fee6b9ca0b2444716c12dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=96=87=E6=B1=9F?= Date: Tue, 6 Sep 2016 21:29:41 +0800 Subject: [PATCH] =?UTF-8?q?ip=E9=BB=91=E7=99=BD=E5=90=8D=E5=8D=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=85=8D=E7=BD=AE=E7=BD=91=E6=AE=B5=E6=9D=A5=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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