limit_req for spiders only

Toni Mueller support-nginx at
Mon Oct 14 11:59:23 UTC 2013


I would like to put a brake on spiders which are hammering a site with
dynamic content generation. They should still get to see the content,
but only not generate excessive load. I therefore constructed a map to
identify spiders, which works well, and then tried to

limit_req_zone $binary_remote_addr zone=slow:10m ...;

if ($is_spider) {
    limit_req zone=slow;

Unfortunately, limit_req is not allowed inside "if", and I don't see an
obvious way to achieve this effect otherwise.

If you have any tips, that would be much appreciated!

Kind regards,

More information about the nginx mailing list