# HttpLimitReq Module not blocking every request?

**URL:** <https://www.ruby-forum.com/t/httplimitreq-module-not-blocking-every-request/205132>\
**Category:** NGINX\
**Created:** [March 30, 2011, 1:26pm UTC](https://www.ruby-forum.com/t/httplimitreq-module-not-blocking-every-request/205132 "2011-03-30T13:26:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [March 30, 2011, 1:26pm UTC](https://www.ruby-forum.com/t/httplimitreq-module-not-blocking-every-request/205132/1 "2011-03-30T13:26:41Z")

</div>

Hello,

I am trying to understand how the HttpLimitReq Module works. I have read  
that it uses the Leaky Bucket Algorithm, however I am not sure how to  
understand the behaviour I am observing. Here is my test setup:

limit\_req\_zone $binary\_remote\_addr zone=one:10m rate=1r/m;  
location /test {  
limit\_req zone=one nodelay;  
}

Every resource under /test should be accessible only once per minute -  
is that right?

Now I have set up a test script to download a file from /test every  
second and I get the following results:  
success  
blocked  
blocked  
blocked  
blocked  
success  
…  
So every fifth request is coming through, so In total I get 12  
successful requests and 48 blocked request per minute. However, from  
the rate setting I would expect to have only one successful download and  
59 blocked requested.

Can anyone explain why this is happening? Also is there a way to  
configure nginx to show the behaviour I am expecting?

Thank you for your help!

Best regards,  
Jonas Kaufmann

Posted at Nginx Forum:

> **[HttpLimitReq Module not blocking every request?](https://forum.nginx.org/read.php?2,186851,186851#msg-186851)**
>
> Hello, I am trying to understand how the HttpLimitReq Module works. I have read that it uses the Leaky Bucket Algorithm, however I am not sure how to understand the behaviour I am observing. Here is my test setup: limit\_req\_zone $binary\_remote\_addr...

---

<div class="post-metadata">

**Author:** ![j0nes2k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@j0nes2k](https://www.ruby-forum.com/u/j0nes2k)\
**Post date:** [March 30, 2011, 2:22pm UTC](https://www.ruby-forum.com/t/httplimitreq-module-not-blocking-every-request/205132/2 "2011-03-30T14:22:57Z")

</div>

Hello!

On Wed, Mar 30, 2011 at 07:26:05AM -0400, j0nes2k wrote:

> is that right?  
> Yes. Once per minute from single ip address.

> successful requests and 48 blocked request per minute. However, from  
> the rate setting I would expect to have only one successful download and  
> 59 blocked requested.
> 
> Can anyone explain why this is happening? Also is there a way to  
> configure nginx to show the behaviour I am expecting?

My bet you’ve forgot to reload config after changing rate.

Maxim D.

---

<div class="post-metadata">

**Author:** ![j0nes2k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@j0nes2k](https://www.ruby-forum.com/u/j0nes2k)\
**Post date:** [March 30, 2011, 2:57pm UTC](https://www.ruby-forum.com/t/httplimitreq-module-not-blocking-every-request/205132/3 "2011-03-30T14:57:38Z")

</div>

Well Maxim… obviously you were right - sorry about this, could have  
checked this earlier. Now everything is working as I expected.

Thanks a lot for your help!

Jonas Kaufmann

Posted at Nginx Forum:

> **[Re: HttpLimitReq Module not blocking every request?](https://forum.nginx.org/read.php?2,186851,186863#msg-186863)**
>
> Hello, I am trying to understand how the HttpLimitReq Module works. I have read that it uses the Leaky Bucket Algorithm, however I am not sure how to understand the behaviour I am observing. Here is my test setup: limit\_req\_zone $binary\_remote\_addr...
