Diagnostic step 1
Check and align timeouts: inspect Node.js server keepAliveTimeout and NGINX keepalive_timeouts. Set Node.js server.keepAliveTimeout > NGINX proxy_read_timeout + a margin.
Generated Oct 24, 2026, 9:21:01 AM
Check and align timeouts: inspect Node.js server keepAliveTimeout and NGINX keepalive_timeouts. Set Node.js server.keepAliveTimeout > NGINX proxy_read_timeout + a margin.
Disable NGINX reuse for WebSocket Upgrade requests by adding proxy_set_header Connection $connection_upgrade and set proxy_http_version to 1.1 and add: map $http_upgrade $connection_upgrade { default 'upgrade'; '' 'close'; } to force new backend TCP handshake on Upgrade.
If keepalive reuse is required, enable proxy_next_upstream to retry on error and lower keepalive connections to reduce stale sockets.
Upgrade NGINX and Node.js to latest stable if on older minor versions; test with a controlled load.
Collect tcpdump on client<->NGINX and NGINX<->upstream for failed Upgrade to confirm backend FIN before NGINX send.