Interview Prep/Networking/Load balancers and reverse proxies

HAProxy returns `503 Service Unavailable — No server is available to handle this request.`

BeginnerTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → Every server in the backend is DOWN (failed health checks) or in maintenance, or the request matched a backend with no servers because of an ACL/use_backend mistake.

Diagnose →

echo "show servers state" | sudo socat stdio /run/haproxy/admin.sock
echo "show stat" | sudo socat stdio /run/haproxy/admin.sock | cut -d, -f1,2,18,37 | column -s, -t
sudo journalctl -u haproxy | grep -i 'is DOWN'

Fix → Fix the backend or the health check (option httpchk GET /healthz, correct port), or correct the routing ACL. A server in MAINT needs set server be_app/web1 state ready.

Prevent → Enable the stats page or Prometheus exporter and alert when a backend's active server count drops.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies