New in Symfony 2.4: Restrict Security Firewalls to specific Hosts
Warning: This post is about an unsupported Symfony version.
Some of this information may be out of date.
Read the most recent Symfony Docs.
Contributed by
Peter Kruithof
in #8905.
Symfony 2.2 introduced host support in the routing system. Symfony 2.4 does the same for the security firewall configuration.
When configuring a firewall, you can restrict it to a given URL path pattern,
like ^/admin/
:
1 2 3 | admin:
pattern: ^/admin
http_basic: true
|
But what if you want to restrict it to admin.example.com
instead? As of
Symfony 2.4, this is really easy:
1 2 3 4 | host:
pattern: ^/
host: admin\.example\.com
http_basic: true
|
Simple and powerful!
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
New in Symfony 2.4: Restrict Security Firewalls to specific Hosts symfony.com/blog/new-in-symfony-2-4-restrict-security-firewalls-to-specific-hosts
Tweet thisComments
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.
Patrik Karisch said on Sep 8, 2013 at 16:12 #1