title: prefixing url_for() behind reverse proxy
body: <p>Scenario: 
  Flask + flask-login behind an HTTP reverse proxy</p>
  
  <p>Flask app at <a href="http://localhost:5000/" rel="nofollow noreferrer">http://localhost:5000/</a>
  Public app at <a href="http://example.com/my_fancy_app/" rel="nofollow noreferrer">http://example.com/my_fancy_app/</a></p>
  
  <p>The reverse proxy sends requests to <a href="http://example.com/my_fancy_app/[stuff]" rel="nofollow noreferrer">http://example.com/my_fancy_app/[stuff]</a> to <a href="http://localhost:/5000/[stuff]" rel="nofollow noreferrer">http://localhost:/5000/[stuff]</a></p>
  
  <p>Using the login_required wrapper:</p>
  
  <pre><code>login_required uses url_for() which redirects back out to http://example.com/[stuff]
  </code></pre>
  
  <p>I need it to redirect to <a href="http://example.com/my_fancy_app/[stuff]" rel="nofollow noreferrer">http://example.com/my_fancy_app/[stuff]</a></p>
  
  <p>Before I fork login_required and add <code>_external=True</code> or support for FlaskView to <code>url_for()</code> calls, is there a good way to set a prefix for all generated URLs in my app that <code>login_required</code> can see?</p>