How to exclude a route from the firewall? (or avoid session cookie)

security, symfony, symfony-2.1

Solution

I didn't test this code, but this regex should work:

firewalls:
    main:
        pattern: ^/(user|admin)(?!/profile)

Problem

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.

Original source