Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/membphis/lua-resty-limits
nginx limit request every second or minute base on openresty
https://github.com/membphis/lua-resty-limits
Last synced: about 1 month ago
JSON representation
nginx limit request every second or minute base on openresty
- Host: GitHub
- URL: https://github.com/membphis/lua-resty-limits
- Owner: membphis
- License: bsd-2-clause
- Created: 2015-06-29T16:26:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-30T14:34:25.000Z (over 9 years ago)
- Last Synced: 2024-02-14T18:32:23.972Z (9 months ago)
- Language: Lua
- Size: 129 KB
- Stars: 8
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-resty - lua-resty-limits
README
# lua-resty-limits
limit nginx request every seconds base on openresty# Use exmaple
```lua
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 [email protected]
if you have any question, please let me know.