title: Why does a NodeJS http server close socket on timeout without response?
body: <p>Given a NodeJS http server with a timeout of 10s:</p>
  
  <pre><code>const httpServer = require('http').createServer(app);
  httpServer.timeout = 10 * 1000;
  </code></pre>
  
  <p>On timeout, Postman shows this without any response code:</p>
  
  <pre><code>Error: socket hang up
  Warning: This request did not get sent completely and might not have all the required system headers
  </code></pre>
  
  <p>If the NodeJS server is behind an nginx reverse proxy, nginx returns a 502 response (<code>upstream prematurely closed connection while reading response header from upstream</code>). But here it is just NodeJS/express running on localhost. Still one would expect a proper http response.</p>
  
  <p>According to <a href="https://stackoverflow.com/a/14123559/1870795">this answer</a>, this is expected behavior, the socket is simply destroyed.</p>
  
  <p>In an architecture with an nginx reverse proxy, is it usual that the server just destroys the socket without sending a timeout response to the proxy?</p>