Symfony The security context contains no authentication token

251 Views Asked by At

I get the message

The security context contains no authentication token. One possible reason may be that there is no firewall configured for this URL.

When my page try to load my assets (css/js/...). But I have not in my web page. My symfony install is under the proxypass /foo

So my URL is http://example.com/foo and my assets are loaded from URL http://example.com/foo/css/...

My page http://example.com/foo/bar works fine but without CSS because http://example.com/foo/css/main.css give me the error above...

Here are my security rules

# security.yml
security:
    providers:
        ezpublish:
            id: ezpublish.security.user_provider
#        in_memory:
#            memory: ~
#
firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    ezpublish_setup:
        pattern: ^/ezsetup
        security: false

    ezpublish_rest:
        pattern: ^/api/ezp/v2
        stateless: true
        ezpublish_http_basic:
            realm: eZ Publish REST API

    ezpublish_front:
        pattern: ^/
        anonymous: ~
        form_login:
            require_previous_session: false
            login_path: /login
            check_path: /login_check
        logout: ~

    default:
        anonymous: ~

I've tried to add this lines between dev and ezpublish_setup

dev2:
    pattern: ^/foo/(css|images|js)/
    security: false

Same error.

I only have this error in prod environment. Everything works fine in dev environment...

Any idea ? Thanks a lot

1

There are 1 best solutions below

0
On

Fixed with

dev:
    pattern: ^/(_(profiler|wdt)|foo/css|foo/images|foo/js)