Multiple proxy_pass destinations from a single location block

justink101 nginx-forum at nginx.us
Wed Feb 4 09:11:01 UTC 2015


Is it possible to specify multiple proxy_pass destinations from a single
location block? Currently we have:

location ~ ^/v1/?(?<url>.+)? {
    resolver 208.67.222.222 208.67.220.220 valid=300s;
    resolver_timeout 10s;
    proxy_intercept_errors off;
    proxy_hide_header Vary;
    proxy_set_header Host "foo.mydomain.io";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass https://foo.mydomain.io/api/$url;
    proxy_connect_timeout 10s;
    proxy_read_timeout 60s;
    proxy_ssl_session_reuse on;
    proxy_ssl_trusted_certificate /etc/pki/tls/certs/ca-bundle.crt;
    proxy_ssl_verify on;
    proxy_ssl_verify_depth 2;
    proxy_ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM
EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256
EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK
!SRP !DSS";
  }

I'd like to keep all the above logic, but ALSO set up another proxy_pass
from this location block to say bar.mydomain.com. What is the best way to do
this?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,256437,256437#msg-256437



More information about the nginx mailing list