Skip to content

Commit 654c2b7

Browse files
authored
docs: add warning about auto-routing and filters
1 parent 5e03647 commit 654c2b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

user_guide_src/source/incoming/routing.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,13 @@ The value for the filter can be a string or an array of strings:
360360

361361
See `Controller filters <filters.html>`_ for more information on setting up filters.
362362

363+
.. Warning:: If you set filters to routes in **app/Config/Routes.php**
364+
(not in **app/Config/Filters.php**), it is recommended to disable auto-routing.
365+
When auto-routing is enabled, it may be possible that a controller can be accessed
366+
via a different URL than the configured route,
367+
in which case the filter you specified to the route will not be applied.
368+
See :ref:`use-defined-routes-only` to disable auto-routing.
369+
363370
**Alias filter**
364371

365372
You specify an alias defined in **app/Config/Filters.php** for the filter value::
@@ -540,6 +547,8 @@ dash isn’t a valid class or method name character and would cause a fatal erro
540547

541548
$routes->setTranslateURIDashes(true);
542549

550+
.. _use-defined-routes-only:
551+
543552
Use Defined Routes Only
544553
-----------------------
545554

0 commit comments

Comments
 (0)