diff options
author | ianb <ianb@localhost> | 2008-06-20 17:15:42 +0000 |
---|---|---|
committer | ianb <ianb@localhost> | 2008-06-20 17:15:42 +0000 |
commit | 36b240b0d48094e0af0d79df87be98f01f0a93c2 (patch) | |
tree | d1dacb13d84384e7344ce03b87e70f3336a33d10 | |
parent | 4237ee81fef4a12dc95139c37f7097c98051f48f (diff) | |
download | pastedeploy-git-36b240b0d48094e0af0d79df87be98f01f0a93c2.tar.gz |
Also translate X-Forwarded-Proto to wsgi.url_scheme
-rw-r--r-- | docs/news.txt | 6 | ||||
-rw-r--r-- | paste/deploy/config.py | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/docs/news.txt b/docs/news.txt index 76be04d..1f95a57 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -4,9 +4,9 @@ Paste Deployment News svn trunk --------- -* In :class:`paste.deploy.config.PrefixMiddleware` the header - ``X-Forwarded-Scheme`` is now translated to the key - ``environ['wsgi.url_scheme']``. +* In :class:`paste.deploy.config.PrefixMiddleware` the headers + ``X-Forwarded-Scheme`` and ``X-Forwarded-Proto`` are now translated + to the key ``environ['wsgi.url_scheme']``. 1.3.2 ----- diff --git a/paste/deploy/config.py b/paste/deploy/config.py index 35de866..7f4c6db 100644 --- a/paste/deploy/config.py +++ b/paste/deploy/config.py @@ -228,8 +228,8 @@ class PrefixMiddleware(object): Also, unless disabled, the ``X-Forwarded-Server`` header will be translated to the ``Host`` header, for cases when that header is - lost in the proxying. Also ``X-Forwarded-Host`` and - ``X-Forwarded-Scheme`` are translated. + lost in the proxying. Also ``X-Forwarded-Host``, + ``X-Forwarded-Scheme``, and ``X-Forwarded-Proto`` are translated. If ``force_port`` is set, SERVER_PORT and HTTP_HOST will be rewritten with the given port. You can use a number, string (like @@ -264,6 +264,8 @@ class PrefixMiddleware(object): environ['HTTP_HOST'] = environ.pop('HTTP_X_FORWARDED_HOST') if 'HTTP_X_FORWARDED_SCHEME' in environ: environ['wsgi.url_scheme'] = environ.pop('HTTP_X_FORWARDED_SCHEME') + elif 'HTTP_X_FORWARDED_PROTO' in environ: + environ['wsgi.url_scheme'] = environ.pop('HTTP_X_FORWARDED_PROTO') if self.force_port is not None: host = environ.get('HTTP_HOST', '').split(':', 1)[0] if self.force_port: |