limit_req for spiders only

Francis Daly francis at daoine.org
Mon Oct 14 14:23:03 UTC 2013


On Mon, Oct 14, 2013 at 01:59:23PM +0200, Toni Mueller wrote:

Hi there,

This is untested, but follows the docs at http://nginx.org/r/limit_req_zone:

> 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;
> }
> 

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

In your map, let $is_spider be empty if is not a spider ("default",
presumably), and be something else if it is a spider (possibly
$binary_remote_addr if every client should be counted individually,
or something else if you want to group some spiders together.)

Then define

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

instead of what you currently have.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list