Execution order of HttpLimitReq, proxy_pass and rewrites

Igor Sysoev igor at sysoev.ru
Wed Mar 30 18:09:04 MSD 2011


On Wed, Mar 30, 2011 at 09:51:16AM -0400, j0nes2k wrote:
> Hello Francis,
> 
> okay, I see. So nginx seems to (randomly?) choose one of the location
> blocks - in my case it was the lower one using the proxy_pass directive.
> 
> 
> However I have several scripts running under /cgi-bin that need
> different limit_req settings - there are scripts that need to have a
> strong limit and others do not need a limit at all. I have tried
> something like
> 
> location /cgi-bin/ {
>    if ($request_filename ~ test\.pl) {
>        limit_req zone=one nodelay burst=3;
>    }
>    proxy_pass http://default_backend/cgi-bin/;
> }
> 
> ...but unfortunately limit_req is not allowed in this context. Is there
> another option how I could get limit_req to work for me?

 location /cgi-bin/ {
    proxy_pass http://default_backend;
 }

 location = /cgi-bin/test.pl {
    limit_req zone=one nodelay burst=3;
    proxy_pass http://default_backend;
 }


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list