limit req - multiple url support

This commit is contained in:
bunkerity
2021-10-18 16:48:06 +02:00
parent bfb5319c16
commit 24d6337a57
3 changed files with 250 additions and 209 deletions

View File

@@ -35,7 +35,10 @@ end
function M.check (rate, burst, sleep)
local key = ngx.var.remote_addr .. ngx.var.uri
local rate_split = rate:gmatch("([^r/]+)")
local rate_split = {}
for str in rate:gmatch("([^r/]+)") do
table.insert(rate_split, str)
end
local max = rate_split[1]
local unit = rate_split[2]
local delay = 0