From 1025a314bfe3dbdec34e194e09ae1218c21af07f Mon Sep 17 00:00:00 2001 From: ludvigalden Date: Sat, 9 Mar 2024 12:43:30 +0100 Subject: [PATCH] fix key error --- src/admin/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/admin/middleware.py b/src/admin/middleware.py index e04a7cbc..3e77dbc2 100644 --- a/src/admin/middleware.py +++ b/src/admin/middleware.py @@ -27,8 +27,8 @@ class TrustedHostMiddleware(MiddlewareMixin): """ def __call__(self, request): - if (request.META['HTTP_HOST'] and - self.is_allowed_host(request.META['HTTP_HOST'])): + current_host = request.META.get('HTTP_HOST', '') + if (current_host and self.is_allowed_host(current_host)): return self.get_response(request) headers_to_check = [