Whitelisting Req/Conn Limiting

B.R. reallfqq-nginx at yahoo.fr
Sat May 31 02:17:31 UTC 2014


1°) To me, the map docs are fairly clear...
In short, the map directive works as follow:

With:
map $foo $bar {
"test1" "value1"
...
}

Whenever the value in $foo matches a value of the first column, $bar will
be set to the value of the second column, ie:
if $foo = "test1", then $bar <- "value1"

If $foo matches nothing, then either:
- there is a special value *default* in the first column, thus $bar will
beset to the corresponding value
- there is no *default* value, $bar will be set to an empty string

2°) Now for the best way to write that, here are my thoughts:

Considering that:
- all servers share 'limit_conn_zone' and 'limit_req_zone usage', except
for some hostname
- the 'if' directive must be avoided as much as possible
- 'limit_conn_zone' and 'limit_req_zone' work in 'http' context

I would try the following:
- put the 'limit_*_zone' directives at 'http' level, next to the 'map' one
- use 'server_name' in 'server' blocks to serve different hostnames
- put 'set whitelist 1' in all whitelisted 'server' blocks
- if necessary (unsure), put 'set whitelist ""' at 'http' level
---
*B. R.*


On Sat, May 31, 2014 at 1:18 AM, SupaIrish <nginx-forum at nginx.us> wrote:

> Gist for easier reading
> https://gist.github.com/supairish/748c85552b2f7047a36a
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,250510,250511#msg-250511
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140531/e2719f75/attachment.html>


More information about the nginx mailing list