<div dir="ltr">Perfect. Thank you!<br><br><br><div class="gmail_quote">On Mon, Aug 4, 2008 at 12:02 PM, Igor Sysoev <span dir="ltr">&lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Mon, Aug 04, 2008 at 09:27:34AM -0400, J Davis wrote:<br>
<br>
&gt; Turns out my if statment just neede a &quot;break;&quot;...<br>
&gt; .<br>
&gt; if ($host = &#39;<a href="http://secondary.example.com" target="_blank">secondary.example.com</a>&#39;) {<br>
&gt; &nbsp; &nbsp; proxy_pass <a href="http://secondary" target="_blank">http://secondary</a>;<br>
&gt; &nbsp; &nbsp; break;<br>
&gt; }<br>
<br>
</div>Actually, you need two servers:<br>
<br>
 &nbsp; &nbsp;server {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server_name <a href="http://primary.example.com" target="_blank">primary.example.com</a>;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;location / {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_pass <a href="http://primary" target="_blank">http://primary</a>;<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header Host $http_host;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; }<br>
 &nbsp; &nbsp;}<br>
<br>
</div> &nbsp; &nbsp;server {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server_name <a href="http://secondary.example.com" target="_blank">secondary.example.com</a>;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;location / {<br>
<div><div></div><div class="Wj3C7c"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_pass <a href="http://secondary" target="_blank">http://secondary</a>;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header Host $http_host;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp;}<br>
<br>
<br>
&gt; Thanks.<br>
&gt; -Jake<br>
&gt;<br>
&gt; On Sun, Aug 3, 2008 at 4:37 PM, J Davis &lt;<a href="mailto:mrsalty0@gmail.com">mrsalty0@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Should it be possible to use a different proxy_pass statement under a<br>
&gt; &gt; single location using if statement?<br>
&gt; &gt; I&#39;ve tried using the following config but all traffic gets passed to the<br>
&gt; &gt; &#39;primary&#39; upstream regardless of the value of $host.<br>
&gt; &gt;<br>
&gt; &gt; upstream primary {<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; server x.x.x.x;<br>
&gt; &gt; &nbsp; &nbsp; }<br>
&gt; &gt;<br>
&gt; &gt; upstream secondary {<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; server x.x.x.x;<br>
&gt; &gt; &nbsp; &nbsp; }<br>
&gt; &gt;<br>
&gt; &gt; location / {<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($host = &#39;<a href="http://secondary.example.com" target="_blank">secondary.example.com</a>&#39;) {<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass <a href="http://secondary" target="_blank">http://secondary</a>;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_set_header Host $http_host;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass <a href="http://primary" target="_blank">http://primary</a>;<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;<br>
&gt; &gt; Many thanks,<br>
&gt; &gt; -Jake<br>
&gt; &gt;<br>
<br>
</div></div><font color="#888888">--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</font></blockquote></div><br></div>