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?

George Shuklin
  • 296
  • 2
  • 11

0 Answers0