Welcome! Log In Create A New Profile

Advanced

Re: Execution order of HttpLimitReq, proxy_pass and rewrites

Francis Daly
March 30, 2011 11:38AM
On Wed, Mar 30, 2011 at 09:51:16AM -0400, j0nes2k wrote:

Hi there,

> 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.

There shouldn't be any randomness involved.

There's a Fine Manual at http://wiki.nginx.org/HttpCoreModule#location

> 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.

As Igor showed, use multiple location blocks.

> I have tried something like
>
> location /cgi-bin/ {
> if ($request_filename ~ test\.pl) {

Note that there's also a special warning about if() inside location{}
at http://wiki.nginx.org/IfIsEvil -- anything other than "return" or
"rewrite ... last" is likely to cause confusion.

> ...but unfortunately limit_req is not allowed in this context. Is there
> another option how I could get limit_req to work for me?

If your scripts don't use PATH_INFO, then something like

location = /script/one {
limit_req ...;
proxy_pass ...;
}

and if they do, then something like

location ^~ /script/two {} or location ^~ /script/two/ {}

with the same contents.

Good luck with it,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Execution order of HttpLimitReq, proxy_pass and rewrites

j0nes2k March 30, 2011 09:28AM

Re: Execution order of HttpLimitReq, proxy_pass and rewrites

Francis Daly March 30, 2011 09:44AM

Re: Execution order of HttpLimitReq, proxy_pass and rewrites

j0nes2k March 30, 2011 09:51AM

Re: Execution order of HttpLimitReq, proxy_pass and rewrites

Igor Sysoev March 30, 2011 10:10AM

Re: Execution order of HttpLimitReq, proxy_pass and rewrites

Francis Daly March 30, 2011 11:38AM

Re: Execution order of HttpLimitReq, proxy_pass and rewrites

j0nes2k March 30, 2011 02:51PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 274
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready