<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">1°) To me, the map docs are fairly clear...<br>In short, the map directive works as follow:<br><br>With:<br>map $foo $bar {<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">

"test1" "value1"<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">...<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">}<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">

Whenever the value in $foo matches a value of the first column, $bar will be set to the value of the second column, ie:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">if $foo = "test1", then $bar <- "value1"<br>

<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">If $foo matches nothing, then either:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">- there is a special value <i>default</i> in the first column, thus $bar will beset to the corresponding value<br>

</div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">- there is no <i>default</i> value, $bar will be set to an empty string<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">

2°) Now for the best way to write that, here are my thoughts:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><br>Considering that:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">

- all servers share 'limit_conn_zone' and 'limit_req_zone usage', except for some hostname<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">- the 'if' directive must be avoided as much as possible<br>

</div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">- 'limit_conn_zone' and 'limit_req_zone' work in 'http' context<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">

I would try the following:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">- put the 'limit_*_zone' directives at 'http' level, next to the 'map' one<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">

- use 'server_name' in 'server' blocks to serve different hostnames<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">- put 'set whitelist 1' in all whitelisted 'server' blocks<br>

</div><div class="gmail_extra">- if necessary (unsure), put 'set whitelist ""' at 'http' level<br clear="all"><div><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div>


<br><br><div class="gmail_quote">On Sat, May 31, 2014 at 1:18 AM, SupaIrish <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us" target="_blank">nginx-forum@nginx.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Gist for easier reading<br>
<a href="https://gist.github.com/supairish/748c85552b2f7047a36a" target="_blank">https://gist.github.com/supairish/748c85552b2f7047a36a</a><br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,250510,250511#msg-250511" target="_blank">http://forum.nginx.org/read.php?2,250510,250511#msg-250511</a><br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div></div>