upstream prematurely closed connection while reading response header
dotcloud, flask, mongodb, nginx
Solution
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 --`
Problem
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