Changes between Version 5 and Version 6 of Ticket #27961
- Timestamp:
- Mar 23, 2017, 11:06:58 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27961 – Description
v5 v6 2 2 1. Both default settings: 3 3 Nginx setting: `proxy_set_header X-Forwarded-Proto $scheme;` 4 Django setting: ~~`HTTP_X_FORWARDED_PROTO=None`~~`SECURE_PROXY_SSL_HEADER = None`4 Django setting: `SECURE_PROXY_SSL_HEADER = None` 5 5 Result: ''No redirect.'' I'm not getting a ''ERR_TOO_MANY_REDIRECTS'' complain from Chrome. 6 6 7 7 2. Use default setting in nginx; use a wrong setting in Django, i.e. the 'httpsssss' part: 8 8 `proxy_set_header X-Forwarded-Proto $scheme;` 9 ~~`HTTP_X_FORWARDED_PROTO='httpssssssss'`~~ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'httpssssssss') 9 `SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'httpssssssss')` 10 10 ''No redirect.'' 11 11 12 12 3. Use default setting in nginx; use a wrong setting in Django: 13 13 `proxy_set_header X-Forwarded-Proto $scheme;` 14 ~~`HTTP_X_FORWARDED_PROTASDF='httpssssssss'`~~ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTASDF', 'httpssssssss') 14 `SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTASDF', 'httpssssssss')` 15 15 ''No redirect.'' 16 16 17 17 4. Use custom HTTPS indicator in both nginx and Django: 18 18 proxy_set_header X-Forwarded-Protooo $scheme; 19 ~~`HTTP_X_FORWARDED_PROTOOO='https'`~~ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOOO', 'https') 19 `SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOOO', 'https')` 20 20 ''No redirect.'' This is the expected behavior. 21 21 22 22 5. Use custom HTTPS indicator in both nginx and Django, and testing for a unsafe protocol ( != 'https'): 23 23 proxy_set_header X-Forwarded-Protooo $scheme; 24 ~~`HTTP_X_FORWARDED_PROTOOO='httpsssss'`~~ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOOO', 'httpsssss') 24 `SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOOO', 'httpsssss')` 25 25 Chrome complains ''ERR_TOO_MANY_REDIRECTS''. This is the expected behavior. 26 26 27 27 6. A fix testing by myself: 28 Add an else clause under [ these lines](https://github.com/django/django/blob/master/django/http/request.py#L196-L197).28 Add an else clause under [https://github.com/django/django/blob/001cf53280f7e2b72199237f37c340d2639fe143/django/http/request.py#L196-L197 these lines]. 29 29 30 30 {{{ … … 35 35 And set: 36 36 `proxy_set_header X-Forwarded-Proto $scheme;` 37 ~~`HTTP_X_FORWARDED_PROTO='httpssssssss'`~~ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'httpssssssss') 37 `SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'httpssssssss')` 38 38 Chrome would report the expected ''ERR_TOO_MANY_REDIRECTS''. 39 39