Welcome! Log In Create A New Profile

Advanced

Re: Whitelisting Req/Conn Limiting

B.R.
May 30, 2014 10:20PM
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@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@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Whitelisting Req/Conn Limiting

SupaIrish May 30, 2014 07:18PM

Re: Whitelisting Req/Conn Limiting

SupaIrish May 30, 2014 07:18PM

Re: Whitelisting Req/Conn Limiting

B.R. May 30, 2014 10:20PM

Re: Whitelisting Req/Conn Limiting

SupaIrish June 01, 2014 05:02AM

Re: Whitelisting Req/Conn Limiting

B.R. June 01, 2014 08:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 186
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready