limit_req inside a if block - Not allowed ?

Harish Sundararaj tuxtoti at gmail.com
Thu Apr 15 14:51:47 MSD 2010


Hi all,

My objective is to apply the limit_req for all requests except  Googlebot.,
So had something like this inside a location context:


limit_req_zone  $binary_remote_addr  zone=one:2m   rate=25r/m; #This piece
of conf is inside a http context

#The below code is inside a location context

if ($http_user_agent !~ Googlebot) {
    limit_req zone=one burst=4;
}

But I get a error :
[emerg]: "limit_req" directive is not allowed here

Is there anyway i can achieve this ?

Thanks,
Harish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100415/b516f4a4/attachment.html>


More information about the nginx mailing list