Directing Traffic Based on Target Hostname


Recommended Posts

So let's imagine I have two servers on the same network with a single incoming internet connection.  I want to run both servers on the same port, let's say 443, so that I don't have to append :someport to the address for the other one.  Now let's also say that I have two domain names, both of which resolve to this same public IP address.  Is it then possible create a port forwarding rule for my router (OpenWRT) to inspect incoming connections, and direct them to the appropriate server based on what domain name they used/resolved to get there?  So that even though they're on the same network and sharing the same single internet connection, the servers can host services on the same external port and trust that users will be auto directed to the correct server based on their intended target.  Can the router even see that information if a packets are encrypted via TLS/HTTPS, or is that part of the data encrypted as well?

Link to comment
Share on other sites

If you can run a reverse proxy on openwrt then what your asking is quite possible. I believe nginx can run on openwrt, but you might have some limitations if your router is ram limited, etc.

 

You could run the reverse proxy on something internal. Or change your router to something like pfsense for example.

 

But yes a reverse proxy would can see that you want to go to www.domainA.com vs say www.domainB.com and send it to the appropriate server.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now