<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"><<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>></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>
> Turns out my if statment just neede a "break;"...<br>
> .<br>
> if ($host = '<a href="http://secondary.example.com" target="_blank">secondary.example.com</a>') {<br>
> proxy_pass <a href="http://secondary" target="_blank">http://secondary</a>;<br>
> break;<br>
> }<br>
<br>
</div>Actually, you need two servers:<br>
<br>
server {<br>
server_name <a href="http://primary.example.com" target="_blank">primary.example.com</a>;<br>
location / {<br>
proxy_pass <a href="http://primary" target="_blank">http://primary</a>;<br>
<div class="Ih2E3d"> proxy_set_header Host $http_host;<br>
}<br>
}<br>
<br>
</div> server {<br>
server_name <a href="http://secondary.example.com" target="_blank">secondary.example.com</a>;<br>
<br>
location / {<br>
<div><div></div><div class="Wj3C7c"> proxy_pass <a href="http://secondary" target="_blank">http://secondary</a>;<br>
proxy_set_header Host $http_host;<br>
}<br>
}<br>
<br>
<br>
> Thanks.<br>
> -Jake<br>
><br>
> On Sun, Aug 3, 2008 at 4:37 PM, J Davis <<a href="mailto:mrsalty0@gmail.com">mrsalty0@gmail.com</a>> wrote:<br>
><br>
> > Should it be possible to use a different proxy_pass statement under a<br>
> > single location using if statement?<br>
> > I've tried using the following config but all traffic gets passed to the<br>
> > 'primary' upstream regardless of the value of $host.<br>
> ><br>
> > upstream primary {<br>
> > server x.x.x.x;<br>
> > }<br>
> ><br>
> > upstream secondary {<br>
> > server x.x.x.x;<br>
> > }<br>
> ><br>
> > location / {<br>
> > if ($host = '<a href="http://secondary.example.com" target="_blank">secondary.example.com</a>') {<br>
> > proxy_pass <a href="http://secondary" target="_blank">http://secondary</a>;<br>
> > }<br>
> > proxy_set_header Host $http_host;<br>
> > proxy_pass <a href="http://primary" target="_blank">http://primary</a>;<br>
> > }<br>
> ><br>
> > Many thanks,<br>
> > -Jake<br>
> ><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>