I'm using symfony 3.4. I have a route in my security.yml file, more specifically in access_control
key. The route goes something like this:
- { path: '^/route/subroute/SOME_TOKEN', roles: [ SOME_ROLE ] }
The SOME_TOKEN
is a urlencoded string that may or may not contain forward slashes in addition to an unknown number of other characters.
Judging by what the docs say here my route should look something like this:
- { path: '^/route/subroute/.+', roles: [ SOME_ROLE ] }
It gives me 404: Route not found.
. Do note that I'm using Apache2 with AllowEncodedSlashes
option enabled.
My guess is that I simply don't know how to write the regex properly. Since I'm bad at regex too, that doesn't come as much of a surprise to me.
I've tried different variations of that. For example (.+)
, [.+]
etc.
# bin/console --env=dev debug:router | grep "/customer/unsubscribe/anon/"
customer_communication_preferences_unsubscribe_anon ANY https ANY /customer/unsubscribe/anon/{hash}
Route definition:
customer_communication_preferences_unsubscribe_anon:
path: /customer/unsubscribe/anon/{hash}
defaults: { _controller: PizokelCustomerBundle:Communication:unsubscribeAnonCustomer }
schemes: ['%routing.scheme.my_account%']