# HG changeset patch # User Marcin Kuzminski # Date 2012-02-27 17:14:21 # Node ID 787f1d1579848087201727be4fac8464f0f41c1a # Parent e121e10d41428b67e2f74d60b807b715bae26acc extended https fixup middleware. diff --git a/rhodecode/lib/middleware/https_fixup.py b/rhodecode/lib/middleware/https_fixup.py --- a/rhodecode/lib/middleware/https_fixup.py +++ b/rhodecode/lib/middleware/https_fixup.py @@ -42,13 +42,21 @@ class HttpsFixup(object): middleware you should set this header inside your proxy ie. nginx, apache etc. """ - proto = environ.get('HTTP_X_URL_SCHEME') if str2bool(self.config.get('force_https')): proto = 'https' - + else: + if 'HTTP_X_URL_SCHEME' in environ: + proto = environ.get('HTTP_X_URL_SCHEME') + elif 'HTTP_X_FORWARDED_SCHEME' in environ: + proto = environ.get('HTTP_X_FORWARDED_SCHEME') + elif 'HTTP_X_FORWARDED_PROTO' in environ: + proto = environ.get('HTTP_X_FORWARDED_PROTO') + else: + proto = 'http' if proto == 'https': environ['wsgi.url_scheme'] = proto else: environ['wsgi.url_scheme'] = 'http' + return None