limit_req seems to have no effect, but I would prefer it did

Valentin V. Bartenev ne at vbart.ru
Tue Oct 9 10:14:45 UTC 2012


On Tuesday 09 October 2012 13:20:00 zildjohn01 wrote:
> I'm attempting to rate limit requests, and I'm unable to make the limit_req
> directive have any effect. I've trimmed it down to a minimal test case.
> Here's my complete nginx.conf (with only the server_name changed to protect
> the innocent):
> 
[...]
> 	limit_req_zone   $binary_remote_addr  zone=req_res:10m  rate=1r/s;
> 	limit_req        zone=req_res;
> 
> 	server {
> 		listen       80;
> 		server_name  example.com  *.example.com;
> 		location / {
> 			return  410;
> 		}
> 	}
[...]
> 
> Am I missing something obvious here?
> 

"return" is a directive from the rewrite module which works on the rewrite 
phase. "limit_req" works on the preaccess phase that comes later. So, your 
request doesn't reach the limit_req module.

 wbr, Valentin V. Bartenev

--
http://nginx.com/support.html



More information about the nginx mailing list