Hello.
I need to check client's user agent and apply different limit_req rules for different UAs.
I've been trying to do it this way:
http {
limit_req_zone $binary_remote_addr zone=bots:10m rate=1r/m;
server {
...
location / {
if ($http_user_agent ~* (google|bing|yandex|msnbot) )
{
limit_req zone=bots burst=5 nodelay;
}
include balancer.conf;
}}}
But apparently I'm missing something as nginx -t says '[emerg]: "limit_req" directive is not allowed here'. Most likely due to poor understanding of configfile syntax. Please advice me on how to achieve my goal.
Thanks in advance.