I have this situation. There are two servers on my network. I don't know why. It's just the way it has been set up. The first server (Server1) has a local ip of 192.168.0.2 and the second one (Server2) has a local ip of 192.168.0.200. On the router, there is a configuration in port forwarding that a request for port 443 will be forwarded to Server1. However, now I need to host my website on Server2 (I can't host it on Server1) and I bought the ssl certificate and installed it. But any requests for https will be forwarded to Server1 as port 443 is the default one when the router see https. How could I solve this problem? My network team opened a new port for me 4430 so I can access my site using https://www.example.com:4430. However, I don't think it's practical for my users. Is there a configuration in port forwarding that I can set for port 443 on the router to determine which server the request should go to? For example changing the protocol and so on. Thanks.
There are basically three possible solutions to this sort of problem all of them have their pros and cons.
- Multiple public IP addresses (and a router that can handle those addresses appropriately).
- A http proxy, your proxy accepts the connection, terminates the ssl/tls and forwards the decrypted traffic (possibly re-encrypting it) based on the http headers.
- A SNI proxy, your proxy accepts the connection but does not decrypt it, it uses the SNI extension in the TLS headers to decide where to forward it to. Downside here is that this only works with modern clients.
You have a few options that I know of. In no particular order:
Purchase a second IP address from your ISP. :443 on first ip goes to first server, :443 on second ip goes to second server. This is standard, inexpensive, and easy to configure.
Use a port other than :443 on the first server.
Specify source. For example, if connections to the first server always arrive with source ip 126.96.36.199, then say 188.8.131.52:xx -> outside_ip:443 goes to Server 1. All other connections to :443 go to server 2.