Nginx rewrite: last & break

Nginx User nginx at
Sat Oct 22 11:04:21 UTC 2011

On 22 October 2011 06:30, Ryan Chan <ryanchan404 at> wrote:
> Anyone would like to do a quick summary for the issue?

Minaev's answer in the serverfault link you provided is the clearest
explanation I have seen to date of this.

To paraphrase, he says, within a location block, when you use "last"
the rewrites are stopped and a new subrequest is generated which will
take all all locations into account. When you use "break" the rewrites
are stopped and processing continued within the location you are in.

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.

More information about the nginx mailing list