Skip to content
Myr

Add X-Forwarded-Proto to proxy setup example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The ProxyFix middleware provided by Werkzeug uses this header for returning accurate values from request.is_secure and request.scheme. Without adding this header, Flask won't properly detect when it is being served over HTTPS and will fail to generate proper external links and cause certain extensions (e.g. Flask-OAuthlib) to function improperly. Adding this header to the example setup should reduce issues encountered by developers when following this guide.

authored by Jon Banafato · committed by Jon Banafato · parent 3fe68c2 · Browse files · 1 file+4 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−3 removed

  • other:+4 added−3 removed

1 file+4 added−3 removed

modified:docs/deploying/wsgi-standalone.rst+4 added-3 removed
95 unmodified lines
96 location / {97 proxy_pass http://127.0.0.1:8000/;98 proxy_redirect off;99100 proxy_set_header Host $host;101 proxy_set_header X-Real-IP $remote_addr;102 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;100 proxy_set_header Host $host;101 proxy_set_header X-Real-IP $remote_addr;102 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;103 proxy_set_header X-Forwarded-Proto $scheme;104 }105 }106107If your httpd is not providing these headers, the most common setup invokes the
27 unmodified lines