diff options
author | ianb <ianb@localhost> | 2008-06-20 17:14:07 +0000 |
---|---|---|
committer | ianb <ianb@localhost> | 2008-06-20 17:14:07 +0000 |
commit | 4237ee81fef4a12dc95139c37f7097c98051f48f (patch) | |
tree | 6d836267d116b257401facbeeb6294fd48663a40 | |
parent | cfc44fc7f6e22ec279fa7519459858214960b7fa (diff) | |
download | pastedeploy-git-4237ee81fef4a12dc95139c37f7097c98051f48f.tar.gz |
Translate X-Forwarded-Scheme to wsgi.url_scheme
-rw-r--r-- | docs/news.txt | 7 | ||||
-rw-r--r-- | paste/deploy/config.py | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/docs/news.txt b/docs/news.txt index 59ecc72..76be04d 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -1,6 +1,13 @@ 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']``. + 1.3.2 ----- diff --git a/paste/deploy/config.py b/paste/deploy/config.py index 6981756..35de866 100644 --- a/paste/deploy/config.py +++ b/paste/deploy/config.py @@ -228,7 +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. + lost in the proxying. Also ``X-Forwarded-Host`` and + ``X-Forwarded-Scheme`` 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 @@ -261,6 +262,8 @@ class PrefixMiddleware(object): environ['SERVER_NAME'] = environ['HTTP_HOST'] = environ.pop('HTTP_X_FORWARDED_SERVER') if 'HTTP_X_FORWARDED_HOST' in environ: 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') if self.force_port is not None: host = environ.get('HTTP_HOST', '').split(':', 1)[0] if self.force_port: |