Answer the question
In order to leave comments, you need to log in
How to limit the number of API requests by key, not by ip?
How to use nginx to limit the number of requests, for a certain period of time, to a unique link? I need to limit the number of API requests not by IP, but by key using nginx. Everywhere where saw similar manuals use restrictions on IP.
Answer the question
In order to leave comments, you need to log in
nginx.org/ru/docs/http/ngx_http_limit_req_module.h...
You can use anything as a key, not necessarily IP.
2 requests per 10 seconds is 12 requests per minute (12r/m)
limit_req_zone $arg_key zone=api:10m rate=12r/m;
location /какой-нужно {
limit_req zone=api burst=1 nodelay;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question