Skip to content

Commit a2f1288

Browse files
[Security]: Simplifying the DEV firewall's pattern
Page: https://symfony.com/doc/6.4/security.html#the-firewall Reasons: * The inner parentheses `_(profiler|wdt)` are overly complicated * AssetMapper recommends to have all assets under `/asset/`: https://symfony.com/doc/6.4/frontend/asset_mapper.html
1 parent 981b4e6 commit a2f1288

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Diff for: security.rst

+4-6
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ will be able to authenticate (e.g. login form, API token, etc).
497497
# the order in which firewalls are defined is very important, as the
498498
# request will be handled by the first firewall whose pattern matches
499499
dev:
500-
pattern: ^/(_(profiler|wdt)|css|images|js)/
500+
pattern: ^/(_profiler|_wdt|assets)/
501501
security: false
502502
# a firewall with no pattern should be defined last because it will match all requests
503503
main:
@@ -529,7 +529,7 @@ will be able to authenticate (e.g. login form, API token, etc).
529529
<!-- the order in which firewalls are defined is very important, as the
530530
request will be handled by the first firewall whose pattern matches -->
531531
<firewall name="dev"
532-
pattern="^/(_(profiler|wdt)|css|images|js)/"
532+
pattern="^/(_profiler|_wdt|assets)/"
533533
security="false"/>
534534
535535
<!-- a firewall with no pattern should be defined last because it will match all requests -->
@@ -555,7 +555,7 @@ will be able to authenticate (e.g. login form, API token, etc).
555555
// the order in which firewalls are defined is very important, as the
556556
// request will be handled by the first firewall whose pattern matches
557557
$security->firewall('dev')
558-
->pattern('^/(_(profiler|wdt)|css|images|js)/')
558+
->pattern('^/(_profiler|_wdt|assets)/')
559559
->security(false)
560560
;
561561
@@ -598,9 +598,7 @@ don't accidentally block Symfony's dev tools - which live under URLs like
598598
pattern:
599599
- ^/_profiler/
600600
- ^/_wdt/
601-
- ^/css/
602-
- ^/images/
603-
- ^/js/
601+
- ^/assets/
604602
# ...
605603
606604
.. code-block:: php

0 commit comments

Comments
 (0)