Thanks very much for the reply, Igor.<div><br class="webkit-block-placeholder"></div><div>If I understand your explanation (which was most excellent), the blocks would result in nearly identical results, but not because of the "break" directive; it is identical because "proxy_pass" does not get inherited to the "if" block. Additionally, since there are no rewrites, the "break" directive has no effect. Is that correct?
</div><div><br class="webkit-block-placeholder"></div><div>It does sound like a refactoring is in order. In Igor we trust! :)</div><div><br class="webkit-block-placeholder"></div><div>JD</div><div><br><div><span class="gmail_quote">
On 9/6/07, <b class="gmail_sendername">Igor Sysoev</b> <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Sep 06, 2007 at 03:22:40PM -0400, Jonathan Dance wrote:<br><br>> I was wondering if anyone could clarify what "break;" does - basically, does<br>> it stop all processing, or only rewrite processing? What is its effect on
<br>> proxy_pass? Here are two simple contrasting examples:<br><br>The "break" stops rewrite module processing only.<br><br>> location / {<br>> if (!-f $request_filename) {<br>> proxy_pass <a href="http://somewhere">
http://somewhere</a>;<br>> break; # does this do anything?<br>> }<br>> }<br><br>Here nginx runs "if" internal opcode, then "break" stops rewrite module<br>execution. nginx uses static configuration inside "if" block.
<br>This configuration inherits all inheritable directives from previous<br>levels (and defaults) and defines the single "proxy_pass" directive.<br>So nginx will go to proxy module.<br><br>> # Is that any different from this?
<br>><br>> location / {<br>> if (-f $request_filename) {<br>> break; # avoid the proxy_pass?<br>> }<br>> proxy_pass <a href="http://somewhere">http://somewhere</a>;<br>> }<br><br>Here nginx runs "if" internal opcode, then "break" stops rewrite module
<br>execution. nginx uses static configuration inside "if" block.<br>This configuration inherits all inheritable directives from previous<br>levels (and defaults). The "proxy_pass" directive is not inheritable,
<br>so nginx go to static module.<br>If "if" condition was false, then nginx uses static configuration<br>inside "localtion /", but outside "if", i.e. - "proxy_pass", etc..<br><br>The current rewrite module state is ugly. This static configuration
<br>inside "if" blocks are terrible.<br><br>I'm going to drop rewrite module and replace it with script module, that<br><br>1) will allow only to set variables inside "if" blocks<br><br>2) will allow to use script in different request processing phases:
<br><br> location / {<br> script << { # URI rewrite phase<br> ...<br> }<br><br> script { # content generation phase<br> ...<br> }<br><br> script >> { # post content generation phase
<br> ...<br> }<br><br><br>--<br>Igor Sysoev<br><a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br><br></blockquote></div><br> </div>