HAProxy serving two domains, but only one is reachable
-
Question from a beginner:
After some research on this topic, and not having any progress, I will ask here.
My firewall is a netgate pfsense 4200 with the packets PFBlockerNG and HAProxy.
To leave my email server with SOGo groupware untouched I added a second physical web server to my setup for other purposes. Therefore I configured HAProxy on my pfsense firewall. I can reach both servers from outside, but only if I delete the NAT rule of server 1 or server 2. If I have both NAT rules enabled, domain 2 is directed to domain 1.
My installation looks like this:
Domain 1: mydomain.tld
Email server 1 with SOGo webmail needing https: server 1 is running on 192.168.180.48Domain 2: www.mydomain.tld
Web server 2 with different web apps needing https: server 2 is running on 192.168.180.50The Let's Encrypt certificates are managed on the servers. So I need HAProxy to just direct the traffic to the right server.
My question: what am I doing wrong? Why does server 2 get directed to server 1? Is it because I configured both NAT rules with target 443 and NAT can only use a port once?
Both NAT rules are identical to this picture below (except address):

-
HAProxy is up and running fine :-). I went the "standard" way.
-
@daro If you want to direct domain.tld to 192.168.180.48 and www.domain.tld to .50 that would be setup in haproxy, not any port forwards.