# Limit IP req/s excl bots

**URL:** <https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597>\
**Category:** NGINX\
**Created:** [September 18, 2013, 3:37pm UTC](https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597 "2013-09-18T15:37:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [September 18, 2013, 3:37pm UTC](https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597/1 "2013-09-18T15:37:32Z")

</div>

Does anyone know if there is any truth to this blog post:

> **[Limit requests per IP on Nginx using HttpLimitZoneModule and...](https://gadelkareem.com/2012/03/25/limit-requests-per-ip-on-nginx-using-httplimitzonemodule-and-httplimitreqmodule-except-whitelist/)**
>
> – Make sure to check Nginx, PHP posts for information on Nginx and PHP setup and configuration. Nginx offers two modules, HttpLimitReqModule and HttpLimitZoneModule, to limit simultaneous connections for the...

And if so where about in the code its implemented? I was trying to find  
out  
if its possible to use a map to control limit req/s limits but I still  
cant  
find the code that does what that article says is possible.

Regards,  
Mathew

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 18, 2013, 3:46pm UTC](https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597/2 "2013-09-18T15:46:53Z")

</div>

I also think I found that 0 length keys wont be stored. This isn’t in  
the  
documentation but if I understand the code correctly they aren’t, is  
this  
correct?

I could use a map then and get considerable flexibility.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 18, 2013, 3:56pm UTC](https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597/3 "2013-09-18T15:56:49Z")

</div>

On Wednesday 18 September 2013 17:45:54 SplitIce wrote:

> I also think I found that 0 length keys wont be stored. This isn’t in the  
> documentation but if I understand the code correctly they aren’t, is this  
> correct?  
> […]

Just a quote from the documentation ([Module ngx\_http\_limit\_req\_module](http://nginx.org/r/limit_req_zone)):

| The key is any non-empty value of the specified variable (empty  
values  
| are not accounted).

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 18, 2013, 3:56pm UTC](https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597/4 "2013-09-18T15:56:49Z")

</div>

Hello!

On Wed, Sep 18, 2013 at 11:15:54PM +0930, SplitIce wrote:

> I also think I found that 0 length keys wont be stored. This isn’t in the  
> documentation but if I understand the code correctly they aren’t, is this  
> correct?

It’s in the documentation, see [Alphabetical index of directives](http://nginx.org/r/limit_req_zone:)

: … The key is any non-empty value of the specified variable (empty  
: values are not accounted). …

> On Wed, Sep 18, 2013 at 11:06 PM, SplitIce [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Does anyone know if there is any truth to this blog post:

> **[Limit requests per IP on Nginx using HttpLimitZoneModule and...](https://gadelkareem.com/2012/03/25/limit-requests-per-ip-on-nginx-using-httplimitzonemodule-and-httplimitreqmodule-except-whitelist/)**
>
> – Make sure to check Nginx, PHP posts for information on Nginx and PHP setup and configuration. Nginx offers two modules, HttpLimitReqModule and HttpLimitZoneModule, to limit simultaneous connections for the...

> > And if so where about in the code its implemented? I was trying to find  
> > out if its possible to use a map to control limit req/s limits but I still  
> > cant find the code that does what that article says is possible.

The configuration provided in the post linked doesn’t do any  
whitelisting. Though it’s mostly trivial to introduce one using a  
map{}.

–  
Maxim D.  
[http://nginx.org/en/donation.html](http://nginx.org/en/donation.html)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 19, 2013, 2:01am UTC](https://www.ruby-forum.com/t/limit-ip-req-s-excl-bots/236597/5 "2013-09-19T02:01:04Z")

</div>

My bad I missed that sentence in the docco.

Thanks, Ill be using map. That blog lead me down the wrong track.
