A database blip made every target fail its "deep" health check, the ALB marked them all unhealthy, and the whole site went down.
AdvancedTroubleshootingLoad balancers and reverse proxies
Answer
Likely causes → The health check endpoint tests downstream dependencies (DB, cache, other services). A shared dependency failing marks every instance unhealthy at once, so a partial outage becomes a full one. (An ALB fails open and routes to all targets when all are unhealthy, but other LBs, Kubernetes readiness, and DNS failover often don't.)
Diagnose →
curl -s http://<target>/healthz | jq . # what does it check?
aws elbv2 describe-target-health --target-group-arn <tg> --query 'TargetHealthDescriptions[].TargetHealth'
Fix → Split checks: a shallow liveness/LB health check (process up, can serve) and a separate readiness or dependency status used for alerting. Let the app degrade gracefully (cached responses, feature flags) instead of failing the health check.
Prevent → Rule: an LB health check should only fail for problems that replacing this instance would fix.
More on Load balancers and reverse proxies
nginx returns `502 Bad Gateway` and the error log says `connect() failed (111: Connection refused) while connecting to upstream`.Beginnernginx returns `504 Gateway Time-out` with `upstream timed out (110: Connection timed out) while reading response header from upstream`.BeginnerAn ALB target group shows all targets `unhealthy` with `Health checks failed with these codes: [404]`.BeginnerAn ALB returns sporadic `502`s, and access logs show `elb_status_code=502` with `target_status_code=-`. Load is low.Intermediatenginx logs `upstream prematurely closed connection while reading response header from upstream`.Intermediatenginx error log shows `no live upstreams while connecting to upstream` and every request gets 502.Intermediate