Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    HAProxy and other hosted sites on the same IP

    Scheduled Pinned Locked Moved pfSense Packages
    2 Posts 2 Posters 959 Views
    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.
    • P
      pbnet
      last edited by

      Hello,
      I've setup HAPROXY to serve several websites on port 80 on the same machine.
      The configuration is the following:

      FEND

      FEND2

      and the backend config:

      BE1

      BE2

      BE3

      OK, so when accessing http://lookingglass.xxxxx.net, everything works fine.
      Also HAPROXY logs show everything is fine:

      HASTATS

      The problems I face are:

      • If I access the WAN's IP I will get to the exact same page as http://lookingglass.xxxx.net, even if I don't use a hostname
      • If I try to host another site on port 80 and use the same HAProxy setup scenario, I will still get presented with the same page as http://lookingglass.xxxx.net

      Any ideas what can be the cause and how can I fix this behavior?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • S
        shadeless
        last edited by

        Not sure if you figured it out already since this post is a few days old, but I think you need to do two things:

        • Remove your "Default Backend" entry (if you have a default entry, everything will be sent to that backend, regardless of the ACL you defined above)
        • For the "Use Backend" action, you wanna populate the "Condition Acl Name" field or else the action wont match.
          So in your case, set the "condition acl name" to "LookingGlass" (the name you gave your "Host Matches:" ACL)

        You now should get a 503 error for all other requests until you define another acl that matches the host name and send that to the same (or a different) backend via another "Use Backend" action entry.

        Hope this helps. Still a beginner with ha proxy so not sure if this is the way to go, but for me in a similar situation that was what I had to do.

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