From 62216df1336bce8260193f04cf6910baaef80132 Mon Sep 17 00:00:00 2001 From: Dylan Young Date: Wed, 25 May 2022 01:35:11 -0300 Subject: [PATCH] fixup! GH-72 Add FormattedPolicyCSPMiddleware --- csp/contrib/formatted_policy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csp/contrib/formatted_policy.py b/csp/contrib/formatted_policy.py index 98ff6e6..60fbb73 100644 --- a/csp/contrib/formatted_policy.py +++ b/csp/contrib/formatted_policy.py @@ -17,7 +17,7 @@ def build_policy(self, request, response): formatters = getattr( settings, 'CSP_POLICY_FORMATTERS', - {'host': lambda request, response: request.META['HTTP_HOST']}, + {'host': lambda request, response: request.get_host()}, ) all_replacements = {} for (csp, report_only, exclude_prefixes) in super().build_policy(