upstream prematurely closed connection while reading response header

Ashu Goel picture Ashu Goel · Aug 20, 2012 · Viewed 19.6k times · Source

I am trying to deploy a Flask Python app on dotcloud (which uses nginx) and MongoDB, and at one point am routing to Twitter for OAuth authorization. Upon trying to route back to my app I get the nginx error described in the title, and have no idea why. Any suggestions? It works perfectly fine in development mode with localhost

Answer

Dmitry Minkovsky picture Dmitry Minkovsky · Dec 3, 2012

Take a look at your uWSGI logs which for me were in /var/log/uwsgi.

I encountered this problem when not having a plugin installed. In my case # apt-get install uwsgi-plugin-python did the trick, because I was trying to execute a python script.

Not having this plugin yielded a 502 from nginx, and in my uWSGI logs I saw:

-- unavailable modifier requested: 0 --