File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,55 @@ The ``dev`` firewall is really a fake firewall: it makes sure that you
561561don't accidentally block Symfony's dev tools - which live under URLs like
562562``/_profiler `` and ``/_wdt ``.
563563
564+ .. tip ::
565+
566+ Instead of creating one long regex to match all routes you want, you're
567+ also able to use an array of simpler regexes to match routes:
568+
569+ .. configuration-block ::
570+
571+ .. code-block :: yaml
572+
573+ # config/packages/security.yaml
574+ security :
575+ # ...
576+ firewalls :
577+ dev :
578+ pattern :
579+ - ^/_profiler/
580+ - ^/_wdt/
581+ - ^/css/
582+ - ^/images/
583+ - ^/js/
584+ # ...
585+
586+ .. code-block :: php
587+
588+ // config/packages/security.php
589+ use Symfony\Config\SecurityConfig;
590+
591+ return static function (SecurityConfig $security): void {
592+ // ...
593+ $security->firewall('dev')
594+ ->pattern([
595+ '^/_profiler/',
596+ '^/_wdt/',
597+ '^/css/',
598+ '^/images/',
599+ '^/js/',
600+ ])
601+ ->security(false)
602+ ;
603+
604+ // ...
605+ };
606+
607+ This feature is not supported by the XML configuration format.
608+
609+ .. versionadded :: 6.4
610+
611+ The possibility to use an array of regex was introduced in Symfony 6.4.
612+
564613All *real * URLs are handled by the ``main `` firewall (no ``pattern `` key means
565614it matches *all * URLs). A firewall can have many modes of authentication,
566615in other words, it enables many ways to ask the question "Who are you?".
You can’t perform that action at this time.
0 commit comments