diff options
author | Santiago Gala <sgala@apache.org> | 2010-03-13 14:58:24 +0100 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2010-03-13 20:40:48 +0100 |
commit | 482b9292ad2b319911863fea45f26fdab9d37e08 (patch) | |
tree | 033f9a3fc28c814a9737486f97f336825e8ecd59 | |
parent | a99242eb0c5ace037376a15b86a2df37f2092666 (diff) | |
download | bottle-482b9292ad2b319911863fea45f26fdab9d37e08.tar.gz |
Use the X-Forwarded-Host header, if present, for the URL
When reverse proxied, the HTTP_HOST header reflects the
wrong request and will break redirect() and other operations.
So, when the X-Forwarded-Host header is present, use it
to compute the request.url property.
-rwxr-xr-x | bottle.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -623,7 +623,7 @@ class Request(threading.local, DictMixin): and includes scheme, host, port, scriptname, path and query string. """ scheme = self.environ.get('wsgi.url_scheme', 'http') - host = self.environ.get('HTTP_HOST', None) + host = self.environ.get('HTTP_X_FORWARDED_HOST', self.environ.get('HTTP_HOST', None)) if not host: host = self.environ.get('SERVER_NAME') port = self.environ.get('SERVER_PORT', '80') |