I have this firewall which includes anything that begins with /user or /admin.
firewalls:
main:
pattern: ^/(user|admin)
But now I need to exclude /user/profile/{user_id}
. Can this be done with a regex? For now, it's fine if it excludes anything that begins with /user/profile, if that's easier.
Is there any other mechanism provided by Symfony2 to exclude routes?
EDIT
I need to totally exclude said route to avoid sending the session cookie; allowing anonymous access with access_control
is not enough. If you know a way to stop that cookie, it can be a solution too.
I didn't test this code, but this regex should work:
firewalls:
main:
pattern: ^/(user|admin)(?!/profile)
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