On 20 October 2011 19:38, Maxim Dounin <mdounin@mdounin.ru> wrote:
> Hello!
>
> On Fri, Oct 21, 2011 at 12:12:01AM +0800, Ryan Chan wrote:
>
>> Hello,
>>
>> According to document: http://wiki.nginx.org/HttpRewriteModule#rewrite
>>
>> It said "break - completes processing of rewrite directives and
>> breakes location lookup cycle by not doing any location lookup and
>> internal jump at all"
>>
>> However, seems my config below is an exception?
>>
>> server {
>> listen 80;
>>
>> server_name .example.com
>> root /data/example/;
>>
>> if ($request_uri ~ "foo") {
>> rewrite ^/foo /bar break;
>> }
>>
>> location /bar {
>> echo "error";
>> }
>> }
>>
>> When I curl using: curl http://example.com/foo
>>
>> the string "error" was returned.
>>
>> However, isn't the break will skip any following location block? So it
>> shouldn't matche the location below, right?
>
> Processing of rewrite directives at server level may be stopped
> via break, but the location lookup will follow anyway (as there is
> no location at this stage where request may be processed).
>
> Note original documentation doesn't say anything about "breakes
> location lookup cycle ...". It's looks like it was added by
> Agentzh here:
>
> http://wiki.nginx.org/index.php?title=HttpRewriteModule&action=historysubmit&diff=7141&oldid=6736
>
> I've reverted it as it's incorrect and obviously causes confusion.
Still quite confusing because the "last" portion goes on to say "after
which searches for corresponding URI and location". As the "break"
part does not say anything, it implies that "after which DOES NOT
search for corresponding URI OR location". I.E. It implies what
agentzh wrote.
Perhaps needs some clarification about it being appropriate at server
level (If I understand you --- totally confused lol).
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx