I am using Symfony 4.1. I am trying to allow/deny a route according the "dev"/"prod" environment.
I tried to define distinct security
configuration files per environment but I am not allow. The following message is displayed loading the Symfony cache :
Configuration path "security.access_control" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.
Here my security section :
security:
access_control:
- { path: '^/$' , roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: '^/ping$' , roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: '^/docs\.json$' , roles: IS_AUTHENTICATED_ANONYMOUSLY }
I want to allow (without authentication) the docs.json
route in dev
environment and restrict (with authentication) the docs.json
route in prod
environment.
Any ideas on how to do that?