title: URL mapping on Flask/Python
body: <p>I am facing one issue in populating URL routes for my endpoints in my app for logging purpose.</p>
  
  <p>The issue arise when using application under Apache wsgi alias, like</p>
  
  <blockquote>
    <p>localhost/mywebapp/</p>
  </blockquote>
  
  <p>My development apache webapp.cong file,</p>
  
  <pre><code>&lt;virtualhost *:80&gt;
      ServerName mywebsite.com
  
      WSGIDaemonProcess webapp user=www-data group=www-data threads=5 home=/home/user/projects/webapp/
      WSGIScriptAlias /mywebapp /home/user/projects/webapp/app.wsgi
  
      &lt;directory /home/user/projects/webapp/&gt;
          WSGIProcessGroup pgadmin
          WSGIApplicationGroup %{GLOBAL}
          WSGIScriptReloading On
          Require all granted
      &lt;/directory&gt;
  &lt;/virtualhost&gt;
  </code></pre>
  
  <p>When I try to fetch list of URL's using below code, </p>
  
  <pre><code>for rule in current_app.url_map.iter_rules('static'):
      print("Endpoint: ", rule.endpoint, "URL: ", rule.rule)
  </code></pre>
  
  <p><strong>Output</strong> (one of the endpoint &amp; url):</p>
  
  <pre><code>Endpoint: 'static' URL: '/static/&lt;path:filename&gt;'
  </code></pre>
  
  <p>I was expecting URL with WSGI alias but I'm not getting url prepended with WSGI alias.</p>
  
  <p><strong>Expected output:</strong></p>
  
  <pre><code>Endpoint: 'static' URL: '/mywebapp/static/&lt;path:filename&gt;'
  </code></pre>
  
  <p>Another interesting thing is when I try to fetch URL with url_for() function, I'm getting proper URL</p>
  
  <pre><code>print(url_for('static', filename='js/require.js'))
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>/mywebapp/static/js/require.js
  </code></pre>
  
  <p>How do I get WSGI prepend URL using <strong>current_app.url_map.iter_rules()</strong> function.</p>