limit_req and limit_conn in rewrite modules if statement
Jonathan Matthews
contact at jpluscplusm.com
Mon Nov 18 21:05:36 UTC 2013
On 18 November 2013 20:57, Nam <nginx-forum at nginx.us> wrote:
> To elaborate a bit more, in a single location I may end up with something
> like this...
>
> set $Whitelisted "No";
> if ($GeoList1 = allow) {
> set $Whitelisted "Yes";
> }
> if ($GeoList5 = allow) {
> set $Whitelisted "Yes";
> }
> if ($http_user_agent ~ (googlebot|bingbot)) {
> set $Whitelisted "Yes";
> }
> if ($Whitelisted ~* "No") {
> limit_conn conlimit-one 5;
> limit_req zone=limit-half burst=9;
> }
Have you looked at using map{}s as the limit_* settings' arguments
instead? They're much nicer than sequential if()s, which may not even
achieve what you want to.
J
More information about the nginx
mailing list