One External IP address on Same Interface for HAProxy and Nat?
I'm setting up a 3 virtual machine environment for website hosting purposes on esxi behind pfsense on a Netgate 2100.
We have 2 external IP addresses from the ISP.
Can we use the same interface and same external IP for both HAProxy and NAT
Currently this is the setup:
VM 1: External static IP 1 NATs to VM1 no problem.
VM 2: External static IP 2 NATs to VM 2 no problem.
Trying with VM3: with same External static IP 2 via HAProxy to VM3. The problem is it redirects to the website on VM1.
You can't if they are all using port 443 (or 80).
You can either redirect port 443 to the internal IP or allow HAProxy to accept that connection on the firewall but not both.
However that's exactly what HAProxy is for. It can accept all the connections on port 443 and send them to the correct server based on the requested URL.