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 &quot;break&quot; directive; it is identical because &quot;proxy_pass&quot; does not get inherited to the &quot;if&quot; block. Additionally, since there are no rewrites, the &quot;break&quot; directive has no effect.&nbsp;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> &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; 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>&gt; I was wondering if anyone could clarify what &quot;break;&quot; does - basically, does<br>&gt; it stop all processing, or only rewrite processing? What is its effect on
<br>&gt; proxy_pass? Here are two simple contrasting examples:<br><br>The &quot;break&quot; stops rewrite module processing only.<br><br>&gt; location / {<br>&gt;&nbsp;&nbsp; if (!-f $request_filename) {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass <a href="http://somewhere">
http://somewhere</a>;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; break; # does this do anything?<br>&gt;&nbsp;&nbsp; }<br>&gt; }<br><br>Here nginx runs &quot;if&quot; internal opcode, then &quot;break&quot; stops rewrite module<br>execution. nginx uses static configuration inside &quot;if&quot; block.
<br>This configuration inherits all inheritable directives from previous<br>levels (and defaults) and defines the single &quot;proxy_pass&quot; directive.<br>So nginx will go to proxy module.<br><br>&gt; # Is that any different from this?
<br>&gt;<br>&gt; location / {<br>&gt;&nbsp;&nbsp; if (-f $request_filename) {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; break; # avoid the proxy_pass?<br>&gt;&nbsp;&nbsp; }<br>&gt;&nbsp;&nbsp; proxy_pass <a href="http://somewhere">http://somewhere</a>;<br>&gt; }<br><br>Here nginx runs &quot;if&quot; internal opcode, then &quot;break&quot; stops rewrite module
<br>execution. nginx uses static configuration inside &quot;if&quot; block.<br>This configuration inherits all inheritable directives from previous<br>levels (and defaults). The &quot;proxy_pass&quot; directive is not inheritable,
<br>so nginx go to static module.<br>If &quot;if&quot; condition was false, then nginx uses static configuration<br>inside &quot;localtion /&quot;, but outside &quot;if&quot;, i.e. - &quot;proxy_pass&quot;, etc..<br><br>The current rewrite module state is ugly. This static configuration
<br>inside &quot;if&quot; blocks are terrible.<br><br>I&#39;m going to drop rewrite module and replace it with script module, that<br><br>1) will allow only to set variables inside &quot;if&quot; blocks<br><br>2) will allow to use script in different request processing phases:
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;location / {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script &lt;&lt; {&nbsp;&nbsp;# URI rewrite phase<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script {&nbsp;&nbsp;# content generation phase<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script &gt;&gt; { # post content generation phase
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br><br>--<br>Igor Sysoev<br><a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br><br></blockquote></div><br>&nbsp;</div>