title: Flask with NGINX proxy_pass
body: <p>I have a python flask server running on localhost:5000</p>
  
  <p>I want NGINX to forward <code>www.example.com/app/rest</code> to <code>localhost:5000/rest</code></p>
  
  <p>Problem is, flask's url_for links will bypass any configuration, for example, I may have this button :</p>
  
  <pre><code>&lt;a href="/rest"&gt;Rest&lt;/a&gt;
  </code></pre>
  
  <p>Which will them route the browser to <code>www.example.com/rest</code>, which maps to nothing.</p>
  
  <p>How can I fix this? From my understanding just changing nxing conf isn't enough, I also need to change something in Flask</p>
  
  <p>My NGINX conf is as follows :</p>
  
  <pre><code>location /deploy/ {
  
        proxy_pass http://localhost:5000/;
        proxy_set_header Host $host;
  
  }
  </code></pre>