Welcome! Log In Create A New Profile

Advanced

Re: Nginx rewrite: last & break

Maxim Dounin
October 23, 2011 11:34AM
Hello!

On Sat, Oct 22, 2011 at 10:25:29AM -0400, locojohn wrote:

> Nginx User Wrote:
> -------------------------------------------------------
>
> > Adding Maxim's statement above into account,
> > outside a location block,
> > "break" behaves just like "last" does since there
> > are no location
> > directives to run here.
> >
> > Someone just needs to update the docs if this is
> > correct.
> >
>
> I have experienced situations when "rewrite something target last;" in
> the server {} section generates the 503 page, while "rewrite something
> target break;" instead works OK. It means that "break" does not behave
> like "last" in the server section of the virtual host either.

The 500, likely. This might happen with nginx before 1.1.6 due to
completely different reason: if there were no matching location
found, the rewrite directives specified at server level were
executed inside an implicit location again.

It is fixed in 1.1.6:

*) Bugfix: the ngx_http_rewrite_module directives specified at "server"
level were executed twice if no matching locations were defined.

Simple and effective way to prevent such sort of problems is to
always define "location /".

Maxim Dounin

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

Nginx rewrite: last & break

Ryan Chan October 20, 2011 12:14PM

Re: Nginx rewrite: last & break

Maxim Dounin October 20, 2011 12:40PM

Re: Nginx rewrite: last & break

Nginx User October 20, 2011 12:56PM

Re: Nginx rewrite: last & break

Ryan Chan October 20, 2011 11:16PM

Re: Nginx rewrite: last & break

agentzh October 21, 2011 12:20AM

Re: Nginx rewrite: last & break

Ryan Chan October 21, 2011 11:32PM

Re: Nginx rewrite: last & break

Nginx User October 22, 2011 07:06AM

Re: Nginx rewrite: last & break

locojohn October 22, 2011 10:25AM

Re: Nginx rewrite: last & break

Ryan Chan October 23, 2011 12:40AM

Re: Nginx rewrite: last & break

Maxim Dounin October 23, 2011 11:28AM

Re: Nginx rewrite: last & break

António P. P. Almeida October 24, 2011 08:14PM

Re: Nginx rewrite: last & break

Maxim Dounin October 23, 2011 11:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 299
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