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

    Solved: HAProxy 503 Proxy Error Caused by Duplicate Backend IDs

    Scheduled Pinned Locked Moved Cache/Proxy
    1 Posts 1 Posters 26 Views 1 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.
    • U Offline
      Unaudited1130
      last edited by

      I ran into an issue with HAProxy that resulted in persistent 503 Service Unavailable errors, even though my backend servers were online and reachable. After a lot of troubleshooting, I found the cause and wanted to share the fix in case anyone else runs into this.

      The goal was to use HAProxy as a reverse proxy for several internal web services, for example:

      • Proxmox on port 8006
      • TrueNAS on port 443
      • A few other servers on my LAN

      Each service had its own backend set up in the GUI.

      Everything appeared configured correctly, but some backends (especially newly duplicated ones) would fail with:

      503 Service Unavailable
      No server is available to handle this request.
      

      However, connecting directly (for example, https://192.168.1.30:8006) worked fine.

      The problem was caused by duplicate internal IDs in the generated HAProxy configuration file. When you clone (duplicate) an existing backend and modify it for a new service, HAProxy reuses the same numeric ID for both backends.

      You can see this by checking your configuration file at /var/etc/haproxy.conf.

      Example:

      backend pfsense_backend
          server truenas 192.168.1.10:443 id 101 ssl verify none
      
      backend proxmox_backend
          server proxmox 192.168.1.30:8006 id 101 ssl verify none
      

      Both backend servers above are using the same id 101.

      Backends with the same IDs leads to connection and 503 errors.

      To fix it, delete that backend completely instead of cloning it and then recreate it from scratch manually. After this, you can check haproxy.conf again, each server line should now have a unique ID.

      Once I recreated the backend, the 503 error disappeared immediately.

      Hope it helps!

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