title: How to figure out Nginx status code 499
body: <p><strong>My Setup :</strong></p>
  
  <blockquote>
    <p>Curl --> AWS ELB --> Nginx --> NodeJS</p>
  </blockquote>
  
  <p>When number of request High then I face this issue. </p>
  
  <p><strong>Nginx access logs</strong></p>
  
  <pre><code>xx.xx.xx.xx - - [30/Oct/2014:13:23:40 +0000] "POST /some/calls/object HTTP/1.1" 499 0 "-" "curl/7.27.0"
  xx.xx.xx.xx - - [30/Oct/2014:13:23:40 +0000] "POST /some/calls/object HTTP/1.1" 499 0 "-" "curl/7.27.0"
  </code></pre>
  
  <p><strong>Nginx error logs</strong></p>
  
  <pre><code>2014/10/30 13:23:40 [info] 11181#0: *17811 client xx.xx.xx.xx closed keepalive connection
  2014/10/30 13:23:40 [info] 11181#0: *17631 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: xx.xx.xx.xx, server: example.com, request: "POST /some/calls/objects HTTP/1.1", upstream: "http://xx.xx.xx.xx:xx/some/calls/object", host: "example.com"
  </code></pre>
  
  <p><strong>NodeJS logs</strong></p>
  
  <pre><code>2014-10-30T13:23:40.074Z : info :  req.method GET
  2014-10-30T13:23:40.074Z : info :  req.url /some/calls/objects
  2014-10-30T13:23:40.074Z : info :  error { message: 'Request Timed Out!' }
  2014-10-30T13:23:40.075Z : info :  req.method GET
  2014-10-30T13:23:40.075Z : info :  req.url /some/calls/objects
  2014-10-30T13:23:40.075Z : info :  error { message: 'Request Timed Out!' }
  2014-10-30T13:23:40.075Z : info :  error.stack undefined
  2014-10-30T13:23:40.076Z : info :  error.stack undefined
  </code></pre>
  
  <hr>
  
  <p><strong>Question</strong> </p>
  
  <p>as per <a href="https://stackoverflow.com/questions/12973304/nginx-an-d-499-error-codes">this link</a> 499 means client closed the connection, but my question is, who is the client in this scenario, is ELB closing the connection or curl or nodejs ? </p>
  
  <p>I've also observed that nodejs takes 60+ seconds to respond calls, if nodejs encounter Timed out issue, then it keep occurring again and again. </p>