5

I would like to set a limit on the number of requests a single client IP address can make to my server, based on their IP address. Nginx has a limit_req_zone directive. However, this directive will actually limit the average hits. If I set my limit to rate=6r/m, it will actually allow only one hit every 10 seconds.

Instead, what I need is an actual limit per minute. E.g. the client should be able to fire 3 or 4 requests quickly after each other or even simultaneously, but not more than e.g. 10 per minute. Is there a way to do this?

Jeroen Ooms
  • 2,239
  • 8
  • 34
  • 51

1 Answers1

5

Ah I think this can be done with the nodelay setting as decribed at the bottom of the limit_req wiki:

If delaying excess requests within a burst is not necessary, you should use the option nodelay:

limit_req   zone=one  burst=5  nodelay;
Jeroen Ooms
  • 2,239
  • 8
  • 34
  • 51