From 8014c96072288e2af954f9d1c63e66fe6da98f73 Mon Sep 17 00:00:00 2001 From: alteredCoder Date: Mon, 31 Jan 2022 13:12:29 +0100 Subject: [PATCH] update --- nginx/crowdsec.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nginx/crowdsec.lua b/nginx/crowdsec.lua index f4c724e..d8fb660 100644 --- a/nginx/crowdsec.lua +++ b/nginx/crowdsec.lua @@ -33,7 +33,7 @@ function csmod.init(configFile, userAgent) captcha_ok = true if runtime.conf["REDIRECT_LOCATION"] == "/" then - ngx.log(ngx.WARN, "redirect location is set to '/' this will lead into infinite redirection") + ngx.log(ngx.ERR, "redirect location is set to '/' this will lead into infinite redirection") end err = recaptcha.New(runtime.conf["SITE_KEY"], runtime.conf["SECRET_KEY"], runtime.conf["CAPTCHA_TEMPLATE_PATH"]) @@ -384,8 +384,9 @@ function csmod.Allow(ip) ngx.log(ngx.ERR, "whitelisted location: " .. v) return end - if utils.ends_with(v, "/") == false then - uri_to_check = v .. "/" + uri_to_check = v + if utils.ends_with(uri_to_check, "/") == false then + uri_to_check = uri_to_check .. "/" end if utils.starts_with(ngx.var.uri, uri_to_check) then ngx.log(ngx.ERR, "whitelisted location: " .. uri_to_check)