Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    HAProxy serving two domains, but only one is reachable

    Scheduled Pinned Locked Moved Cache/Proxy
    3 Posts 2 Posters 268 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      daro
      last edited by

      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.48

      Domain 2: www.mydomain.tld
      Web server 2 with different web apps needing https: server 2 is running on 192.168.180.50

      The 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):

      be867ffc-1a8c-47d2-9498-f3fdb6ff9c29-grafik.png

      D 1 Reply Last reply Reply Quote 0
      • D Offline
        daro @daro
        last edited by

        HAProxy is up and running fine :-). I went the "standard" way.

        johnpozJ 1 Reply Last reply Reply Quote 0
        • johnpozJ Online
          johnpoz LAYER 8 Global Moderator @daro
          last edited by

          @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.

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 26.03 | Lab VMs 2.8.1, 26.03

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.