lmit_req with differents rules
Maxim Dounin
mdounin at mdounin.ru
Thu Dec 15 19:41:14 UTC 2022
Hello!
On Thu, Dec 15, 2022 at 09:50:46AM -0300, Rejaine Monteiro wrote:
> Hello!!
>
> I need apply different limit_req rules with different rules, like
>
> limit_req_zone $binary_remote_addr zone=ipsrc:10m rate=1r/s;
> limit_req_zone $arg_token zone=apitoken:10m rate=5r/m;
> limit_req_zone $http_autorization zone=httpauth:10m rate=5r/s;
>
> server {
> listen 443;
> server_name api.domain.com;
> }
>
> location / {
> limit_req zone=ipsrc;
> limit_req zone=apitoken;
> limit_req zone=httpauth;
> proxy_pass http://internal.api.com;
> }
> }
>
> Would this be correct and should it work as expected?
This is certainly supported, see http://nginx.org/r/limit_req for
details.
Note that it might be a good idea to add some meaningful "burst"
to the configuration, as well as "nodelay".
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list