I successfully implemented rate limiting in the nginx-configuration with limit_req_zone
and limit_req
as documented on the nginx blog
The rate limiting settings is configured pretty strict. So I sometimes run into the rate-limit if I have to do some admin tasks.
So my question is:
Is it possible to somehow reset this rate limiting without restarting the nginx-process?
Restarting the nginx-process works, but I did not find another solution in the docs or online.
2
Answers
I believe it’s really better for you to find a url location pattern, for your admin area. in that case you can define another rate limit with a much higher limit and set it for that specific url. something like this:
To achieve your goal, it would not help much to reset the whole memory_zone, wouldnât it? However for NGINX Plus it is possible to reset a whole memory zone using the NGINX Plus API.
http://nginx.org/en/docs/http/ngx_http_api_module.html#http_limit_reqs_http_limit_req_zone_name
The NGINX API module is just available with the commercial subscription and does not come along with NGINX OSS.
If you would need to reset the rate limit per
rate_key
or user / client, I would highly recommend to define a header / cookie /remote adders for such tasks / clients that will exclude such clients / tasks from the rate limiting.For example. If your are logged in and send the cookie you can validate the cookie and exclude admins from the rate limit for all URLs. Same for some known remote addresses. This is the common way to achieve such tasks and is also mentioned in the blog you have just found.
Happy to learn more about the use case if this does not apply to your requirements.