The nginx wiki states:
break - completes processing of current rewrite directives and non-rewrite processing continues within the current location block only.
Is this to say that:
If the rewrite pattern matches, process the rewrite (rewrite to target) but do not process any of the other rules in the location block, and process all other (cache, proxy, etc) directives in the location block?
I am talking about the break flag as per:
PATTERN TARGET FLAG
Not the "break;" directive.
UPDATE:
The scenario I was thinking of using this for is as follows, a simple location with multiple rewrites:
location /path/ {
rewrite ^/user_request_one$ /target_one;
rewrite ^/user_request_two$ /target_two;
... other directives ...
}
Perhaps I dont understand fully how nginx handles rewrites, but in the above, if target_one is matched, will nginx still test rewrite rule target_two? Would adding a break flag to target_one instruct nginx to stop parsing any further rewrite rules?
The main reason I am asking is because we have some location blocks with a number of rewrite rules and I am unsure weather nginx is testing rewrite patterns "further down" even if one is matched "near the top". These rewrites are very unique, so if one is hit, there is absolutely no reason for nginx to test any others in the same location block. We just want to make sure we are not wasting any precious cpu cycles as this is a fairly loaded server.
Hope this helps.
Thanks.
There is a good explanation on the HttpRewriteModule page: http://wiki.nginx.org/HttpRewriteModule#rewrite
It's possibly a good idea to have a look at "How nginx processes a request" first: http://nginx.org/en/docs/http/request_processing.html
EDIT: yes, your interpretation is what break does
break will keep the request processing within the same location directive so you can enforce how it is handled even if the rewritten path would, under normal circumstances (i.e. being requested directly), be handled by a different location directive. Note that this only happens when used inside a location directive.
Sorry I couldn't expand further, I'm running out the door but feel free to ask for details of any part of my answer.