dynamic rate limiting per ip

Yichun Zhang (agentzh) agentzh at gmail.com
Mon Jan 6 19:33:23 UTC 2014


On Thu, Jan 2, 2014 at 12:54 PM, theotow wrote:
> Any Ideas if this is possible with the limit_rate of the http core module
> and lua?

You can use ngx_lua alone to do this.

> If it would be possible to make 2 zone dicts where the ips of the the slow
> and fast connections are in. And if someone ratelimit is dropped his ip gets
> removed from the slow dict and added to the fast dict.
> https://github.com/chaoslawful/lua-nginx-module#ngxshareddict

Yes, you can surely do that. You can use ngx.sleep() to hold back the
exceeding clients without blocking other requests served by the same
nginx worker.


More information about the nginx mailing list