1

I want to create a reverse proxy under one location for two different upstreams. Upstreams are so different that they have different prefixes in URL, but the rest is the same.

Non-working configuration:

    upstream foo{
        server https://foo.example.com/foo;
        server https://bar.example.net/bar backup;
    }

    server{
      ...
      location /foobar/(.+) {
         proxy_pass https://foo/$1?args
      }
   }

I know I can't use URL in 'upstream' section, and I know I can't use two servers in a proxy_pass directive, but is there any way to use nginx as 'failover balancer' for two different URLs?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.