Flask 404 when using SERVER_NAME
Just found the answer. Apache has an option called ProxyPreserveHost
. Once it's set to On, everything works as expected.
More information here: http://flask.pocoo.org/mailinglist/archive/2011/3/14/problem-with-apache-proxy-and-canonical-urls/