Welcome! Log In Create A New Profile

Advanced

Re: 502 errors with nginx+gunicorn

Maxim Dounin
September 08, 2014 10:58PM
Hello!

On Mon, Sep 08, 2014 at 05:01:07PM -0400, xkillac4 wrote:

> Hi all,
>
> I am sending large post request to gunicorn/django behind nginx. If
> gunicorn responds and closes the connection before nginx has finished
> sending the large request body, it causes nginx to issue a 502 Bad Gateway
> response instead of the app server's response. This scenario happens e.g.,
> if the endpoint requires authentication but the request is not authenticated
> (401 or 403).
>
> More info here: https://github.com/benoitc/gunicorn/issues/872
>
> As noted in the linked gunicorn issue, I've worked around this by making
> sure django waits for the entire request to come in before responding. Not
> sure if this is something you guys are interested in looking into, but
> thought I'd share.

This looks like classic problem, solved with lingering close in
http world (see [1] for nginx own implementation details). There
isn't much nginx can do in this case - it's something to be
resolved in a backend software.

[1] http://nginx.org/r/lingering_close

--
Maxim Dounin
http://nginx.org/

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

502 errors with nginx+gunicorn

xkillac4 September 08, 2014 05:01PM

Re: 502 errors with nginx+gunicorn

Maxim Dounin September 08, 2014 10:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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