Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Reverse proxy with multiple interfaces

$
0
0
I use NGINX to reverse proxy incoming requests from a network interface to a WIldfly application server listening on port 8080. The config is simple:

server {
listen 80;
server_name application.mynet.com;

location /myapplication {
proxy_pass http://127.0.0.1:8080/myapplication/;
}
}

That works as expected. But what if I add a second network interface to the box such that requests from the LAN arrive on one interface, requests from the internet on the other? Let's say that the two interfaces have address 192.168.10.10 and 192.168.20.20 - Is this valid? The incoming URL is the same in both cases, but they are handled differently depending on the interface the request arrived on.

// If the request came from the LAN interface, route it to myapplication
location /myapplication {
proxy_bind 192.168.10.10
proxy_pass http://127.0.0.1:8080/myapplication/;
}

// If the request came from the Internat interface, route it to someotherapplication
location /myapplication {
proxy_bind 192.168.20.20
proxy_pass http://127.0.0.1:8080/someotherapplication/;
}

Thanks.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>