Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect request to two Upstream server in Nginx

Tags:

nginx

I have un upstream list in my Nginx config. And I would to proxy path each request on two servers instead of one.

For example if I have IP1, IP2 and IP3 in my upstream list. I receive a request on /process and I want to redirect this request to two of three servers available in the upstream list (IP1 and IP2 for instance).

Thanks ! :)

like image 233
jeremieca Avatar asked Oct 21 '22 06:10

jeremieca


1 Answers

Here's how i think your config could be, you can create multiple upstreams

upstream  main_upstream  {
    server   IP1
    server   IP2
    server   IP3
}
upstream  process_upstream  {
    server   IP2
    server   IP3
}

server {
    location /process {
        proxy_pass  http://process_upstream;
    }
    location / {
        proxy_pass http://main_upstream;
}
like image 148
Mohammad AbuShady Avatar answered Oct 25 '22 20:10

Mohammad AbuShady