From d69c93912da9cf63c6828871c1218ba6346383e1 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 10 Oct 2026 15:11:18 +0200 Subject: [PATCH] docs: clarify hostname route matching includes the port The hostname route option is compared against the full HTTP_HOST value, including the port. Document that routes restricted by hostname must include the port when the application is served on a non-standard port (e.g. localhost:8080, Docker, php spark serve). --- user_guide_src/source/incoming/routing.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index 7dda8b687131..07e1cd0df1b8 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -476,6 +476,15 @@ by passing the "hostname" option along with the desired domain to allow it on as This example would only allow the specified hosts to work if the domain exactly matched **accounts.example.com**. It would not work under the main site at **example.com**. +.. note:: + + The ``hostname`` option is compared against the full ``HTTP_HOST`` value of the + request, including the port when one is present. When your application is served + on a non-standard port (for example ``localhost:8080``, behind Docker, or when + using ``php spark serve``), you must include the port in the ``hostname`` option for + the routes to match. For example, ``['hostname' => 'localhost:8080']`` matches only + requests to ``localhost:8080``. + Restrict by Multiple Hostnames ------------------------------