Interview Prep/Networking/Load balancers and reverse proxies

HAProxy logs show `504` responses with termination state `sH--`.

IntermediateTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → HAProxy's termination flags read: first letter s = server-side timeout, second H = while waiting for response headers. So the backend accepted the request but didn't send headers within timeout server. (Compare cD = client-side timeout during data, SC = server refused the connection.)

Diagnose →

grep ' sH-- ' /var/log/haproxy.log | awk '{print $9, $NF}' | sort | uniq -c | sort -rn | head
# Tr (server response time) in the timers field shows how long the server took

Fix → Fix the slow backend, or raise timeout server for that backend only. Make sure the backend's own timeout is shorter so it fails cleanly instead of HAProxy cutting it.

Prevent → Learn the termination flags table; parse them into your log pipeline as fields and alert on s* timeouts per backend.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies