Node.js · Senior · Question 17 of 75
Behind a load balancer (e.g., AWS ALB with a 60 s idle timeout), clients sometimes get 502 errors. What's a common cause?
- ✓Correct answer: Node's
server.keepAliveTimeoutis shorter than the load balancer's idle timeout, so Node closes connections the balancer still reuses - 2Node.js limits each process to 60 connections
- 3The load balancer doesn't support HTTP/1.1
Explanation
Set keepAliveTimeout above the balancer's idle timeout (and headersTimeout above that) so the balancer always closes idle connections first.