0

I am running 2 VMs that they both are listening to ports 80/443. I have just one public IP and several subdomains that are pointing to my public IP. I would like to somehow be able to access both VMs on ports 80/443.

The scenario I have in mind is to somehow involve a third VM which will receive the 80/443 requests from the outside world and redirect them accordingly to the VMs. That third VM it could act as a "Proxy" which will make the requests on the VMs using the local IP which no ports are involved. Im not quite sure if thats possible, but Im open to any suggestions.

Diagram

  • Unfortunately questions about host/server/VM configurations are off-topic here, as are questions about protocols above OSI layer-4. You could try to ask this question on Server Fault for a business network, or on Super User for a personal network. – Ron Maupin Dec 6 '17 at 14:46
2

You can't solve this problem on a port-forwarding, reverse NAT basis. You'll need a reverse proxy that terminates the HTTP/S connection and uses the backend server to serve the request based on the URL requested. Squid and nginx come to mind, but I'm afraid proxies are off-topic here.

Alternatively, you need more than one "routed" public IP address.

Note that the router will not forward through the DNS server. When a DNS name is used for forwarding the external port, the DNS server is used to learn the IP address of the server and the router then forwards the packets directly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.