Welcome! Log In Create A New Profile

Advanced

Re: nginx silently drops response body of POST depending on its length

Maxim Dounin
May 09, 2011 06:54AM
Hello!

On Sun, May 08, 2011 at 03:15:28PM -0400, zildjohn01 wrote:

> I've come across an incredibly weird problem with POST responses using
> nginx 1.0.1 and uWSGI 0.9.7.2 on CentOS 5.6.
>
> uWSGI successfully sends the response body to nginx, but nginx seems to
> ignore it if both (1) the request method is POST, and (2) the response
> length is less than 4052 bytes. The issue doesn't occur when serving
> directly using `uwsgi --http`, so I'm pretty sure the problem is
> something to do with nginx.
>
> To explain things in code, this Python results in the desired response:
>
> ....def app_uwsgi(environ, start_response):
> ........start_response('200 OK', [('Content-type', 'text/html')])
> ........return [b'x' * 4052]
>
> while this results in zero bytes being sent to the client for POST
> requests:
>
> ....def app_uwsgi(environ, start_response):
> ........start_response('200 OK', [('Content-type', 'text/html')])
> ........return [b'x' * 4051]
>
> I stripped down to a minimal nginx.conf, and the issue still occurs:
>
> ....events {
> ........worker_connections 1024;
> ....}
>
> ....http {
> ........upstream uwsgi_connect {
> ............server 127.0.0.1:39275;
> ........}
>
> ........server {
> ............listen 20101;
> ............server_name domain.net;
>
> ............location / {
> ................uwsgi_pass uwsgi_connect;
> ................include uwsgi_params;
> ............}
> ........}
> ....}
>
> Does anyone have any clue what could be causing this behavior?

As it was already said - you have to read body of POST before
sending reply. Else you'll get something like

.... readv() failed (54: Connection reset by peer) while reading
upstream ...

in nginx error log and possibly incorrect reply (depending on various
factors, including sizes and event method used).

Maxim Dounin

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

nginx silently drops response body of POST depending on its length

zildjohn01 May 08, 2011 03:15PM

Re: nginx silently drops response body of POST depending on its length

roberto May 09, 2011 01:44AM

Re: nginx silently drops response body of POST depending on its length

Maxim Dounin May 09, 2011 06:54AM

Re: nginx silently drops response body of POST depending on its length

zildjohn01 May 09, 2011 12:19PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 320
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