Are symfony-specific files behind the firewall?

I have a simple login and security page configured as follows:

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
            use_referer: true
            always_use_default_target_path: true
            default_target_path: /
        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/, role: ROLE_ADMIN }

And in my base.html.twig file I have

{% stylesheets '@BrStgCcBundle/Resources/public/css/bootstrap.css' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

And including this file only works if I logged in to the application. Therefore, after entering the system, the system detects this asset, but before it does not happen, and when I follow the created connection by assetic, I am redirected to the login page.

In the view, the link is as follows:

<link rel="stylesheet" href="/app_dev.php/css/026adfc_bootstrap_1.css" />

This file exists on disk, and when called, when it is registered, the correct CSS is displayed, when it is not registered, it redirects me to the login page.

+5
source share
2 answers

. , dir (pattern: ^/) (: ^/, role: ROLE_ADMIN). , css :

- { path: ^/css, role: IS_AUTHENTICATED_ANONYMOUSLY }
+5

, , security.yml:

firewalls:
    dev:
        pattern:    ^/(_profiler|_wdt|css|js|assets)
        security:   false
+17

All Articles