I'm using nginx to serve static file and proxy other requests to some Tomcat instance. The problem is that I don't know how to choose which IP address will nginx use to connect to Tomcat.
Each Tomcat instance only accept HTTP connections from specific IP addresses. My server has all these IPs. I just can't choose which one will nginx use.
This is my config file:
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location /integracao/ {
proxy_pass http://X.X.X.X:9080/integracao/;
}
location /solr/ {
proxy_pass http://Y.Y.Y.Y:8080/solr/;
}
My server has one interface with two IP addresses: A and B. I need to use IP A to connect to first Tomcat and IP B to connect to Solr.
Do anyone knows how to do it?