In my Flask config, I\'m setting SERVER_NAME to a domain like \"app.example.com\". I\'m doing that because I need to use url_for with _external URLs.
url_for
_external
Just found the answer. Apache has an option called ProxyPreserveHost. Once it's set to On, everything works as expected.
ProxyPreserveHost
More information here: http://flask.pocoo.org/mailinglist/archive/2011/3/14/problem-with-apache-proxy-and-canonical-urls/