multiple proxy_pass

J Davis mrsalty0 at gmail.com
Mon Aug 4 00:37:39 MSD 2008


Should it be possible to use a different proxy_pass statement under a single
location using if statement?
I've tried using the following config but all traffic gets passed to the
'primary' upstream regardless of the value of $host.

upstream primary {
        server x.x.x.x;
    }

upstream secondary {
        server x.x.x.x;
    }

location / {
            if ($host = 'secondary.example.com') {
                proxy_pass http://secondary;
            }
            proxy_set_header Host $http_host;
            proxy_pass http://primary;
        }

Many thanks,
-Jake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080803/ab968b73/attachment.html>


More information about the nginx mailing list