Nginx Load Balance with proxy_ pass

104 Views Asked by At

I am working on nginx proxy pass with load balancer and the problem is that I have 2 different url for both the backend server, let say my domain is xyzzy.com and 1 request out of 10 should go to xyz-1.com/123/xyz/andsoon and another 9 request should go to xyz-2.com/456/456/andsoon

how to achieve this using nginx configuration.

1

There are 1 best solutions below

2
On

You must provide weight to your upstream servers:

upstream myapp1 {
        server  xyz-2.com/456/456/andsoon weight=9;
        server  xyz-1.com/123/xyz/andsoon;
    }

http://nginx.org/en/docs/http/load_balancing.html#nginx_weighted_load_balancing