From d7673d9edabf96a18176325cd7fde41d96d89bb8 Mon Sep 17 00:00:00 2001 From: Min ho Kim Date: Mon, 12 Aug 2019 20:51:26 +1000 Subject: [PATCH] Switched to use `HTTP_X_FORWARDED_PROTO` custom header in tests. This is the conventional name: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto --- tests/settings_tests/tests.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index 3770d15a3d..d663f6e819 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -361,24 +361,24 @@ class SecureProxySslHeaderTest(SimpleTestCase): req = HttpRequest() self.assertIs(req.is_secure(), False) - @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTOCOL', 'https')) + @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO', 'https')) def test_set_without_xheader(self): req = HttpRequest() self.assertIs(req.is_secure(), False) - @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTOCOL', 'https')) + @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO', 'https')) def test_set_with_xheader_wrong(self): req = HttpRequest() - req.META['HTTP_X_FORWARDED_PROTOCOL'] = 'wrongvalue' + req.META['HTTP_X_FORWARDED_PROTO'] = 'wrongvalue' self.assertIs(req.is_secure(), False) - @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTOCOL', 'https')) + @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO', 'https')) def test_set_with_xheader_right(self): req = HttpRequest() - req.META['HTTP_X_FORWARDED_PROTOCOL'] = 'https' + req.META['HTTP_X_FORWARDED_PROTO'] = 'https' self.assertIs(req.is_secure(), True) - @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTOCOL', 'https')) + @override_settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO', 'https')) def test_xheader_preferred_to_underlying_request(self): class ProxyRequest(HttpRequest): def _get_scheme(self): @@ -387,7 +387,7 @@ class SecureProxySslHeaderTest(SimpleTestCase): # Client connects via HTTP. req = ProxyRequest() - req.META['HTTP_X_FORWARDED_PROTOCOL'] = 'http' + req.META['HTTP_X_FORWARDED_PROTO'] = 'http' self.assertIs(req.is_secure(), False)