<div dir="ltr">Should it be possible to use a different proxy_pass statement under a single location using if statement?<br>I've tried using the following config but all traffic gets passed to the '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">secondary.example.com</a>') { <br>
proxy_pass <a href="http://secondary">http://secondary</a>;<br> }<br> proxy_set_header Host $http_host;<br> proxy_pass <a href="http://primary">http://primary</a>;<br> }<br>
<br>Many thanks,<br>-Jake<br></div>