Fix debug output for SSLMiddleware X-Forwarded-Proto

Before this patch debug output was excessive.
Now print the line log if wsgi.url_scheme differ and

Change-Id: I925a7dd0844dfa76696b75e9f818d1bb47b34928
Closes-Bug: #1605806
This commit is contained in:
Artem Tiumentcev 2016-10-19 15:31:30 +03:00
parent 0b1f29e4ba
commit 1c14cc322e

View File

@ -47,8 +47,9 @@ class SSLMiddleware(wsgi.Middleware):
cfg.CONF.secure_proxy_ssl_header.upper().replace('-', '_'))
def process_request(self, req):
LOG.debug('Default url_scheme: {0}. {1}: {2}'.format(
req.environ['wsgi.url_scheme'], self.secure_proxy_ssl_header,
req.environ.get(self.secure_proxy_ssl_header)))
url_scheme = req.environ['wsgi.url_scheme']
req.environ['wsgi.url_scheme'] = req.environ.get(
self.secure_proxy_ssl_header, req.environ['wsgi.url_scheme'])
if url_scheme != req.environ['wsgi.url_scheme']:
LOG.debug('Changed url_scheme from {0} to {1}'.format(
url_scheme, req.environ['wsgi.url_scheme']))