I am trying to implement host routing in Symfony 2.2. I have added the route to app/config/routing.yml, but the security restrictions in app/config/security.yml are redirecting the requests.
For example, I have (www.)domain1.com and {subdomain}.domain2.com. I want the security restrictions in security.yml to apply only to {subdomain}.domain2.com (my app), and not to (www.)domain1.com (my home page).
How can this be achieved? I am looking for something like this:
security:
firewalls:
home_page:
host: (www.)domain1.com
security: false
You can restrict access by hostname with ACL like this:
# app/config/security.yml
security:
# ...
access_control:
- { roles: ROLE_USER_WWW, host: www.yourdomain.com }
- { roles: ROLE_USER, host: yourdomain.com }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With