##// END OF EJS Templates
extended https fixup middleware.
marcink -
r2054:787f1d15 beta
parent child Browse files
Show More
@@ -42,13 +42,21 b' class HttpsFixup(object):'
42 42 middleware you should set this header inside your
43 43 proxy ie. nginx, apache etc.
44 44 """
45 proto = environ.get('HTTP_X_URL_SCHEME')
46 45
47 46 if str2bool(self.config.get('force_https')):
48 47 proto = 'https'
49
48 else:
49 if 'HTTP_X_URL_SCHEME' in environ:
50 proto = environ.get('HTTP_X_URL_SCHEME')
51 elif 'HTTP_X_FORWARDED_SCHEME' in environ:
52 proto = environ.get('HTTP_X_FORWARDED_SCHEME')
53 elif 'HTTP_X_FORWARDED_PROTO' in environ:
54 proto = environ.get('HTTP_X_FORWARDED_PROTO')
55 else:
56 proto = 'http'
50 57 if proto == 'https':
51 58 environ['wsgi.url_scheme'] = proto
52 59 else:
53 60 environ['wsgi.url_scheme'] = 'http'
61
54 62 return None
General Comments 0
You need to be logged in to leave comments. Login now