Flask 3 · Testing and deployment

Trust a reverse proxy

Read the real client IP and scheme when behind Nginx.

from werkzeug.middleware.proxy_fix import ProxyFix

app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1)

Official Flask 3 documentation

More testing and deployment commands

All testing and deployment commands · Flask 3 cheatsheet

Was this page helpful?