Skip to content

Commit d42da43

Browse files
authored
Merge pull request #5449 from kenjis/fix-docs-filters.rst
docs: improve filters.rst
2 parents 4f65e0a + bfd0812 commit d42da43

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

user_guide_src/source/incoming/filters.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ Configuring Filters
9191
Once you've created your filters, you need to configure when they get run. This is done in **app/Config/Filters.php**.
9292
This file contains four properties that allow you to configure exactly when the filters run.
9393

94+
.. Note:: The safest way to apply filters is to :ref:`disable auto-routing <use-defined-routes-only>`, and :ref:`set filters to routes <applying-filters>`.
95+
96+
.. Warning:: It is recommended that you should always add ``*`` at the end of a URI in the filter settings.
97+
Because a controller method might be accessible by different URLs than you think.
98+
For example, when auto-routing is enabled, if you have ``Blog::index``,
99+
it can be accessible with ``blog``, ``blog/index``, and ``blog/index/1``, etc.
100+
94101
$aliases
95102
========
96103

@@ -133,7 +140,7 @@ run on every request. Filters can be specified by adding their alias to either t
133140
There are times where you want to apply a filter to almost every request, but have a few that should be left alone.
134141
One common example is if you need to exclude a few URI's from the CSRF protection filter to allow requests from
135142
third-party websites to hit one or two specific URI's, while keeping the rest of them protected. To do this, add
136-
an array with the 'except' key and a uri to match as the value alongside the alias::
143+
an array with the 'except' key and a URI to match as the value alongside the alias::
137144

138145
public $globals = [
139146
'before' => [

0 commit comments

Comments
 (0)