Skip to content
Myr

Touch up proxying docs.

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

authored by Ron DuPlain · committed by Ron DuPlain · parent 9a1d616 · Browse files · 1 file+11 added−6 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+11 added−6 removed

  • other:+11 added−6 removed

1 file+11 added−6 removed

modified:docs/deploying/wsgi-standalone.rst+11 added-6 removed
78 unmodified lines
79setups, but you might want to write your own WSGI middleware for specific80setups.8182Here's a simple nginx configuration which proxies to an application served on83localhost at port 8000, setting appropriate headers::83localhost at port 8000, setting appropriate headers:8485.. sourcecode:: nginx8687 server {88 listen 80;8990 server_name _;
10 unmodified lines
101 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;102 }103 }104103The most common setup invokes the host being set from `X-Forwarded-Host`104and the remote address from `X-Forwarded-For`::105If your httpd is not providing these headers, the most common setup invokes the106host being set from `X-Forwarded-Host` and the remote address from107`X-Forwarded-For`::108109 from werkzeug.contrib.fixers import ProxyFix110 app.wsgi_app = ProxyFix(app.wsgi_app)111109Please keep in mind that it is a security issue to use such a middleware110in a non-proxy setup because it will blindly trust the incoming111headers which might be forged by malicious clients.112.. admonition:: Trusting Headers113114 Please keep in mind that it is a security issue to use such a middleware in115 a non-proxy setup because it will blindly trust the incoming headers which116 might be forged by malicious clients.117118If you want to rewrite the headers from another header, you might want to119use a fixer like this::120121 class CustomProxyFix(object):
11 unmodified lines