Welcome! Log In Create A New Profile

Advanced

Re: Nginx returns HTTP 200 with Content-Length: 0

July 23, 2013 11:12PM
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.
Subject Author Posted

Nginx returns HTTP 200 with Content-Length: 0

dennis dang June 11, 2011 12:14AM

Re: Nginx returns HTTP 200 with Content-Length: 0

apeman May 16, 2013 03:32AM

Re: Nginx returns HTTP 200 with Content-Length: 0

apeman May 16, 2013 04:48AM

Re: Nginx returns HTTP 200 with Content-Length: 0

spdyg May 18, 2013 08:50AM

Re: Nginx returns HTTP 200 with Content-Length: 0

apeman May 20, 2013 03:29AM

Re: Nginx returns HTTP 200 with Content-Length: 0

suttya May 20, 2013 12:04PM

Re: Nginx returns HTTP 200 with Content-Length: 0

apeman May 21, 2013 06:40AM

Re: Nginx returns HTTP 200 with Content-Length: 0

suttya May 21, 2013 11:06AM

Re: Nginx returns HTTP 200 with Content-Length: 0

apeman May 21, 2013 09:56PM

Re: Nginx returns HTTP 200 with Content-Length: 0

bruiselee July 16, 2013 11:51AM

Re: Nginx returns HTTP 200 with Content-Length: 0

Maxim Dounin May 22, 2013 11:22AM

Re: Nginx returns HTTP 200 with Content-Length: 0

crazynuxer July 02, 2013 11:23AM

Re: Nginx returns HTTP 200 with Content-Length: 0

bkoski July 23, 2013 11:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 269
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready