Show More
@@ -42,13 +42,21 b' class HttpsFixup(object):' | |||||
42 | middleware you should set this header inside your |
|
42 | middleware you should set this header inside your | |
43 | proxy ie. nginx, apache etc. |
|
43 | proxy ie. nginx, apache etc. | |
44 | """ |
|
44 | """ | |
45 | proto = environ.get('HTTP_X_URL_SCHEME') |
|
|||
46 |
|
45 | |||
47 | if str2bool(self.config.get('force_https')): |
|
46 | if str2bool(self.config.get('force_https')): | |
48 | proto = 'https' |
|
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 | if proto == 'https': |
|
57 | if proto == 'https': | |
51 | environ['wsgi.url_scheme'] = proto |
|
58 | environ['wsgi.url_scheme'] = proto | |
52 | else: |
|
59 | else: | |
53 | environ['wsgi.url_scheme'] = 'http' |
|
60 | environ['wsgi.url_scheme'] = 'http' | |
|
61 | ||||
54 | return None |
|
62 | return None |
General Comments 0
You need to be logged in to leave comments.
Login now