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.
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,
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.
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.