๐Ÿ“ฆ membphis / lua-resty-limits

nginx limit request every second or minute base on openresty

โ˜… 8 stars โ‘‚ 5 forks ๐Ÿ‘ 8 watching โš–๏ธ BSD 2-Clause "Simplified" License
๐Ÿ“ฅ Clone https://github.com/membphis/lua-resty-limits.git
HTTPS git clone https://github.com/membphis/lua-resty-limits.git
SSH git clone git@github.com:membphis/lua-resty-limits.git
CLI gh repo clone membphis/lua-resty-limits
membphis membphis add new rate api 4355432 10 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ conf
๐Ÿ“ lua
๐Ÿ“ resty
๐Ÿ“„ .gitignore
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ README.md

lua-resty-limits

limit nginx request every seconds base on openresty

Use exmaple

local limits = require("resty.iresty_limits")
local limits = limits.new()

-- the rate is 80bytes/seconds, you can input 80K(means 80KB/sec) too.
limits:rate("80")

-- 
ngx.say("check request is allowed: ", 
    limits:reqs_per_range(ngx.var.binary_remote_addr, ngx.var.uri, 1, 2))

provide by membphis@gmail.com

if you have any question, please let me know.