Flask

WSGI path prefix mismatch causes 404 when app mounted at subpath

warning
configurationUpdated Mar 19, 2026(via Exa)
Technologies:
How to detect:

Flask app mounted at /myapp on WSGI server receives requests at /myapp/api/users but Flask routing sees /api/users, causing mismatch and 404s.

Recommended action:

Use werkzeug ProxyFix middleware with x_prefix=1 to handle path prefix: 'from werkzeug.middleware.proxy_fix import ProxyFix; app.wsgi_app = ProxyFix(app.wsgi_app, x_prefix=1)'.