Nginx returns HTTP 200 with Content-Length: 0

bkoski nginx-forum at
Wed Jul 24 03:12:40 UTC 2013

I had a very similar problem using nginx to front rainbows/rails.  Even
though rails was definitely returning a JSON response, ngnix always
responded with 200 OK, Content-Length: 0, and an empty body.

The strange thing was that the error was related to the size of the incoming
POST. When the request body was small everything worked fine, the full
response from Rails appeared.  But as soon as the request was >100kb the
response was always blank.

In my case, the logs were filled with errors like "readv() failed (104:
Connection reset by peer) while reading upstream."  That error led me to
this post
 It turns out that if you do not read incoming POST data (in Rails, using this will cause the "connection reset" error which in
turn results in a blank response body.

Posted at Nginx Forum:,205826,241182#msg-241182

More information about the nginx mailing list