basic antibot feature through cookie

This commit is contained in:
bunkerity
2020-10-11 11:46:24 +02:00
parent 652d8ac979
commit 6e1c43c4cd
4 changed files with 73 additions and 1 deletions

22
lua/cookie.lua Normal file
View File

@@ -0,0 +1,22 @@
local M = {}
local session = require "resty.session"
function M.is_set ()
local s = session.open()
if s and s.data.uri then
return true
end
return false
end
function M.set ()
local s = session.start()
s.data.uri = ngx.var.request_uri
s:save()
end
function M.get_uri ()
return session.open().data.uri
end
return M