limit_req inside a if block - Not allowed ?

Harish Sundararaj tuxtoti at
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 ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list