Problem with nginx rate limiting not working when using white listing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with nginx rate limiting not working when using white listing

vergil
I have nginx rate-limiting working when using the following

limit_req_zone $binary_remote_addr zone=mylimit:20m rate=50r/m;

I now want to apply it to certain IPs so i've changed it to

   geo $limit {
    default 1;
    1.2.3.4/32 0;
  }

   map $limit $mylimit {
     0 "";
     1 $binary_remote_addr;
   }

   limit_req_zone $my_limit zone=mylimit:20m rate=50r/m;

Following the example here https://www.nginx.com/blog/rate-limiting-nginx/

But the rate limit is ignored even when coming from a different IP than the
one in the config

This is using nginx version: nginx/1.14.0 (Ubuntu)

In the server block I have

limit_req zone=mylimit burst=15 nodelay;

which was working before

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,288487,288487#msg-288487

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Problem with nginx rate limiting not working when using white listing

J.R.
One place you have $mylimit and another is $my_limit (with the underscore).
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx