Interview Prep/Networking/Load Balancing, Proxies & nginx in Production

How do you troubleshoot intermittent 502 and 504 errors behind a load balancer?

IntermediateProductionLoad Balancing, Proxies & nginx in Production
Answer

502: check backend crashes and restarts, keep-alive mismatch, backend closing connections, TLS mismatch to the target, oversized headers. 504: slow responses beyond the timeout, saturated workers, dependency latency, or target group timeouts. Correlate ALB access logs (target_status_code, target_processing_time, elb_status_code) with app logs.

# elb_status_code=502 and target_status_code=- means target closed or reset connection
All Networking questions Roadmap: Networking for DevOps

More on Load Balancing, Proxies & nginx in Production