NAT for the same ports to different LAN IPs

Behind pfsense winth one WAN I have two servers.
One webmail (mail.domain.xxx) in LAN IP 192.168.1.3 and one website (www.domain.xxx) in LAN IP 192.168.1.4.
Both operate on ports 80 and 443.
How do I do NAT?
mail.domain.com - LAN IP 192.168.1.3 → 80 and 443
www.domain.com - LAN IP 192.168.1.4 → 80 and 443
I understand that I have to use Haproxy but I can’t find a step by step tutorial for the above situation.
Can someone help me with the steps?
I appreciate any help!

I think you’ll have to use a proxy server to do the redirect based on the fqdn. You could use HAProxy in pfSense or set up a standalone proxy server in a DMZ.

I tried. I can’t make them work:
One WAN IP to
mail.domain.com” - LAN IP 192.168.1.3 → 80 and 443
www.domain.com” - LAN IP 192.168.1.4 → 80 and 443
The truth is that I have never used HAProxy and I can’t even find a step by step tutorial exactly on this situation.
Something escapes me and I don’t know what.
I appreciate any help

Have you checked out this video? How To Setup ACME, Let's Encrypt, and HAProxy HTTPS offloading on pfsense - YouTube

1 Like