Solved: HAProxy 503 Proxy Error Caused by Duplicate Backend IDs
-
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 noneBoth 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.confagain, each server line should now have a unique ID.Once I recreated the backend, the 503 error disappeared immediately.
Hope it helps!