Nginx uwsgi (104: Connection reset by peer) while reading response header from upstream

前端 未结 8 2257
感动是毒
感动是毒 2020-12-12 23:34

Environment is Nginx + uwsgi.

Getting a 502 bad gateway error from Nginx on certain GET requests. Seems to be related to the length of the URL. In our particular cas

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 00:31

    I was getting the same nginx error and also there was no information in uwsgi log. The problem was that in some cases the application was not consuming the whole request body as advised in http://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html:

    If an HTTP request has a body (like a POST request generated by a form), you have to read (consume) it in your application. If you do not do this, the communication socket with your webserver may be clobbered. If you are lazy you can use the post-buffering option that will automatically read data for you. For Rack applications this is automatically enabled.

    Of course, this is not a problem in your case, but it may be useful for others who are getting the same nginx error.

提交回复
热议问题