antibot - check IP with sessions and recaptcha

This commit is contained in:
bunkerity 2020-10-23 15:12:52 +02:00
parent 68d7988551
commit 397415211e
2 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
set $session_secret %ANTIBOT_SESSION_SECRET%;
set $session_check_addr on;
access_by_lua_block {

View File

@ -30,7 +30,7 @@ function M.check (token, recaptcha_secret)
local res, err = httpc:request_uri("https://www.google.com/recaptcha/api/siteverify", {
ssl_verify = false,
method = "POST",
body = "secret=" .. recaptcha_secret .. "&response=" .. token,
body = "secret=" .. recaptcha_secret .. "&response=" .. token .. "&remoteip=" .. ngx.var.remote_addr,
headers = { ["Content-Type"] = "application/x-www-form-urlencoded" }
})
if not res then