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
http://stackoverflow.com/questions/10393203/error-readv-failed-104-connection-reset-by-peer-while-reading-upstream.
 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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to