Skip to content

Commit

Permalink
do not alter host if already correct
Browse files Browse the repository at this point in the history
  • Loading branch information
ludvigalden committed Mar 9, 2024
1 parent b8cdb38 commit 74b87e0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/admin/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class TrustedHostMiddleware(MiddlewareMixin):
"""

def __call__(self, request):
if (request.META['HTTP_HOST'] and
self.is_allowed_host(request.META['HTTP_HOST'])):
return self.get_response(request)

headers_to_check = [
('HTTP_X_FORWARDED_HOST', 'X-Forwarded-Host'),
('HTTP_HOST', 'Host'),
Expand Down

0 comments on commit 74b87e0

Please sign in to comment.