Nginx returns HTTP 200 with Content-Length: 0
nginx-forum at nginx.us
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
It turns out that if you do not read incoming POST data (in Rails, using
request.body.read) this will cause the "connection reset" error which in
turn results in a blank response body.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,205826,241182#msg-241182
More information about the nginx