diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
index d65a5ed..302865f 100644
--- a/django/core/handlers/base.py
+++ b/django/core/handlers/base.py
@@ -311,6 +311,9 @@ class BaseHandler:
             resolver = get_resolver(urlconf)
         else:
             resolver = get_resolver()
+        # Request middleware may have normalized proxy headers. Validate the
+        # effective host before resolving the URL or calling view middleware.
+        request.get_host()
         # Resolve the view, and assign the match object back to the request.
         resolver_match = resolver.resolve(request.path_info)
         request.resolver_match = resolver_match
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index a1ab130..a929780 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -103,9 +103,12 @@ is validated against ``['.localhost', '127.0.0.1', '[::1]']``.
 ``ALLOWED_HOSTS`` is also :ref:`checked when running tests
 <topics-testing-advanced-multiple-hosts>`.
 
-This validation only applies via :meth:`~django.http.HttpRequest.get_host`;
-if your code accesses the ``Host`` header directly from ``request.META`` you
-are bypassing this security protection.
+Django calls :meth:`~django.http.HttpRequest.get_host` before resolving the
+request URL, after middleware has had the opportunity to normalize proxy
+headers. Middleware that uses the host before calling ``get_response()``,
+including middleware that returns its own response, should call
+:meth:`~django.http.HttpRequest.get_host` to obtain the validated host.
+Reading a header directly from ``request.META`` doesn't validate it.
 
 .. setting:: APPEND_SLASH
 
diff --git a/docs/releases/6.2.txt b/docs/releases/6.2.txt
index fc7475a..1e7c400 100644
--- a/docs/releases/6.2.txt
+++ b/docs/releases/6.2.txt
@@ -458,6 +458,12 @@ Models
 Requests and responses
 ----------------------
 
+* Django now checks :setting:`ALLOWED_HOSTS` before URL resolution even when
+  no middleware or view calls :meth:`~django.http.HttpRequest.get_host`.
+  Requests that reach URL resolution with a disallowed host now receive a
+  400 response. Middleware that returns a response earlier remains responsible
+  for validating any host it uses.
+
 * Most Django-provided middleware now set ``async_capable = False`` to
   avoid repetitive context switching in ``MiddlewareMixin.__acall__()`` under
   ASGI. For atypical use cases, e.g. high in-process concurrency over non-ORM
diff --git a/docs/topics/security.txt b/docs/topics/security.txt
index 075bc98..471115c 100644
--- a/docs/topics/security.txt
+++ b/docs/topics/security.txt
@@ -225,9 +225,10 @@ Because even seemingly-secure web server configurations are susceptible to fake
 :setting:`ALLOWED_HOSTS` setting in the
 :meth:`django.http.HttpRequest.get_host` method.
 
-This validation only applies via :meth:`~django.http.HttpRequest.get_host`;
-if your code accesses the ``Host`` header directly from ``request.META`` you
-are bypassing this security protection.
+The request handler calls :meth:`~django.http.HttpRequest.get_host` before
+resolving the URL. Middleware that reads the host earlier should use the same
+method. Accessing headers directly through ``request.META`` doesn't validate
+them.
 
 For more details see the full :setting:`ALLOWED_HOSTS` documentation.
 
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index b1da08f..beedb70 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -199,6 +199,51 @@ def empty_middleware(get_response):
     pass
 
 
+def last_forwarded_host_middleware(get_response):
+    def middleware(request):
+        forwarded = request.META["HTTP_X_FORWARDED_HOST"]
+        request.META["HTTP_X_FORWARDED_HOST"] = forwarded.split(",")[-1].strip()
+        return get_response(request)
+
+    return middleware
+
+
+@override_settings(
+    ALLOWED_HOSTS=["example.com"], ROOT_URLCONF="handlers.urls", MIDDLEWARE=[]
+)
+class HostValidationTests(SimpleTestCase):
+    def test_disallowed_host(self):
+        with self.assertLogs("django.security.DisallowedHost", "ERROR"):
+            response = self.client.get("/regular/", headers={"host": "other.test"})
+        self.assertEqual(response.status_code, 400)
+        self.assertIsNone(response.wsgi_request.resolver_match)
+
+    async def test_disallowed_host_async(self):
+        with self.assertLogs("django.security.DisallowedHost", "ERROR"):
+            response = await self.async_client.request(
+                path="/async_regular/", headers=[(b"host", b"other.test")]
+            )
+        self.assertEqual(response.status_code, 400)
+        self.assertIsNone(response.asgi_request.resolver_match)
+
+    def test_allowed_host(self):
+        response = self.client.get("/regular/", headers={"host": "example.com:8080"})
+        self.assertContains(response, "regular content")
+
+    @override_settings(
+        MIDDLEWARE=["handlers.tests.last_forwarded_host_middleware"],
+        USE_X_FORWARDED_HOST=True,
+    )
+    def test_forwarded_host_after_middleware(self):
+        for host, status in [("example.com", 200), ("other.test", 400)]:
+            with self.subTest(host=host):
+                response = self.client.get(
+                    "/regular/",
+                    headers={"x-forwarded-host": f"proxy.internal, {host}"},
+                )
+                self.assertEqual(response.status_code, status)
+
+
 @override_settings(ROOT_URLCONF="handlers.urls")
 class HandlerRequestTests(SimpleTestCase):
     request_factory = RequestFactory()
