NGINX: Forward any request to 2 servers


Recommended Posts

Can someone help me configuring Nginx such that if any request comes on 10.10.10.10:443, it should forward it to 2 servers

1. Internal server i,e 10.10.10.11

2. External server 1.e 66.66.66.66 (eg)

 

I am thinking of below but it will load balance the requests and NOT forward it to both the servers at same time.  Any recommendations?

http {
upstream forward {
server 10.10.10.11:443;
server  66.66.66.66:443;
}

server {
listen 443;

location / {
proxy_pass http://forward ;
}
}
}

TIA

Link to comment
Share on other sites

What am I trying to achieve?

 

If any request comes to Nginx server, it should forward the request to 2 destinations i.e 1 destination will serve the request and another destination is a third party service which will track the requests ( with many additional features ) that were made to destination 1.  I hope this clears the doubt.  

 

TIA...

Link to comment
Share on other sites

Sounds like you need something server side (server 1) that just accepts the request and sends the ack to (server 2) to track the request. That would be the proper way to do this.

Link to comment
Share on other sites

Seems this can be achieved via LUA.  They have provided us the Lua configuration which was successful in Dev environment.

 

Thanks !!

Link to comment
Share on other sites

This topic is now closed to further replies.