@@ -482,9 +482,12 @@ will be able to authenticate (e.g. login form, API token, etc).
482
482
security :
483
483
# ...
484
484
firewalls :
485
+ # the order in which firewalls are defined is very important, as the
486
+ # request will be handled by the first firewall whose pattern matches
485
487
dev :
486
488
pattern : ^/(_(profiler|wdt)|css|images|js)/
487
489
security : false
490
+ # a firewall with no pattern should be defined last because it will match all requests
488
491
main :
489
492
lazy : true
490
493
# provider that you set earlier inside providers
@@ -510,10 +513,14 @@ will be able to authenticate (e.g. login form, API token, etc).
510
513
511
514
<config >
512
515
<!-- ... -->
516
+
517
+ <!-- the order in which firewalls are defined is very important, as the
518
+ request will be handled by the first firewall whose pattern matches -->
513
519
<firewall name =" dev"
514
520
pattern =" ^/(_(profiler|wdt)|css|images|js)/"
515
521
security =" false" />
516
522
523
+ <!-- a firewall with no pattern should be defined last because it will match all requests -->
517
524
<firewall name =" main"
518
525
lazy =" true" />
519
526
@@ -532,11 +539,15 @@ will be able to authenticate (e.g. login form, API token, etc).
532
539
533
540
return static function (SecurityConfig $security): void {
534
541
// ...
542
+
543
+ // the order in which firewalls are defined is very important, as the
544
+ // request will be handled by the first firewall whose pattern matches
535
545
$security->firewall('dev')
536
546
->pattern('^/(_(profiler|wdt)|css|images|js)/')
537
547
->security(false)
538
548
;
539
549
550
+ // a firewall with no pattern should be defined last because it will match all requests
540
551
$security->firewall('main')
541
552
->lazy(true)
542
553
0 commit comments