title: What is going on when I set app.wsgi_app = ProxyFix(app.wsgi_app) when running a Flask app on gunicorn?
body: <p>I built a basic web app using Flask, and was able to run it from a virtual machine using its native http server. I quickly realized that with this set up, requests are blocking (I couldn't make concurrent requests for resources; any new request would wait until earlier requests had finished), and decided to try gunicorn to run the app to solve this problem. I followed the <a href="http://flask.pocoo.org/docs/deploying/wsgi-standalone/" rel="noreferrer">documentation</a>, specifically running with this line:</p>
  
  <pre><code>gunicorn -w 4 -b 127.0.0.1:4000 myproject:app 
  </code></pre>
  
  <p>However, it failed to boot doing just this, and complained that there was no WSGI app. Poking around the internet, I found that a number of people had posted examples including the following:</p>
  
  <pre><code>from werkzeug.contrib.fixers import ProxyFix
  app.wsgi_app = ProxyFix(app.wsgi_app)
  </code></pre>
  
  <p>I added that, and it resolved my problem. I am confused though because this is apparently meant to solve a problem serving behind an HTTP proxy, but would the addition of gunicorn impose an HTTP proxy? Or was I always behind a proxy, and it just didn't matter for Flask's built-in server? </p>
  
  <p>Also, <a href="http://werkzeug.pocoo.org/docs/contrib/fixers/" rel="noreferrer">Werkzeug's documentation on Fixers</a> warns "Do not use this middleware in non-proxy setups for security reasons." Considering the fix was clearly necessary, can I assume I'm on a proxy setup?</p>