Question

I'm testing my Symfony2 development at production environment but for some reason some files aren't loaded and I can't find the issue. First, see the picture below:

items not loaded

As you can see many files, failed to load, internal and external (coming from CDN for example). Before test my site on production I run the command assetic:dump this create the files under /web/css, /web/images and /web/js respectively. This is what I have in my security.yml:

security:
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            pattern: ^/
            anonymous: ~
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
            logout:
                 path: fos_user_security_logout
                 target: /
                 invalidate_session: false
            anonymous:   true

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

Since I though the problem comes from firewall but I test with this rules under access_control:

        - { path: ^/web/css, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/web/js, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/web/images, role: IS_AUTHENTICATED_ANONYMOUSLY }

And didn't work either so I'm complete lost at this point. I have checked also the existence of the files by running the command ll /var/www/html/sunahip/web/css/

and this is the output, so files are there:

total 888
-rw-r--r-- 1 apache root  43509 Jul 29 03:23 19f3b62.css
-rw-r--r-- 1 apache root   6899 Jul 29 03:23 19f3b62_part_1_dataTables.bootstrap_1.css
-rw-r--r-- 1 apache root   1792 Jul 26 17:10 19f3b62_part_1_reveal_1.css
-rw-r--r-- 1 apache root   1792 Jul 29 03:23 19f3b62_part_1_reveal_2.css
-rw-r--r-- 1 apache root  34575 Jul 26 17:10 19f3b62_part_1_style_2.css
-rw-r--r-- 1 apache root  34575 Jul 29 03:23 19f3b62_part_1_style_3.css
-rw-r--r-- 1 apache root    240 Jul 26 17:10 19f3b62_part_1_tboverride_3.css
-rw-r--r-- 1 apache root    240 Jul 29 03:23 19f3b62_part_1_tboverride_4.css
-rw-r--r-- 1 apache root  34159 Jul 29 03:23 5302d9e.css
-rw-r--r-- 1 apache root  34159 Jul 29 03:23 5302d9e_style_1.css
-rw-r--r-- 1 apache root  34400 Jul 29 03:23 615c560.css
-rw-r--r-- 1 apache root  34159 Jul 29 03:23 615c560_style_2.css
-rw-r--r-- 1 apache root    240 Jul 29 03:23 615c560_tboverride_1.css
-rw-r--r-- 1 apache root  36367 Jul 28 18:06 c6b91bf.css
-rw-r--r-- 1 apache root   4302 Jul 28 18:06 c6b91bf_part_1_genstyles_1.css
-rw-r--r-- 1 apache root  10328 Jul 28 18:06 c6b91bf_part_1_style_2.css
-rw-r--r-- 1 apache root  21735 Jul 28 18:06 c6b91bf_part_1_style_org_3.css
-rw-r--r-- 1 apache root 110939 Jul 26 17:10 fd438b4_bootstrap.min_1.css
-rw-r--r-- 1 apache root  18932 Jul 26 17:10 fd438b4_bootstrap-theme.min_2.css
-rw-r--r-- 1 apache root 129872 Jul 26 17:10 fd438b4.css
-rw-r--r-- 1 apache root 110939 Jul 29 03:23 styles_bootstrap.min_1.css
-rw-r--r-- 1 apache root  18932 Jul 29 03:23 styles_bootstrap-theme.min_2.css
-rw-r--r-- 1 apache root 129872 Jul 29 03:23 styles.css

where is the issue? Where I'm failing? Did I miss something else?

Added VirtualHost info

All this site is under a virtualhost, this is the definition for it:

<VirtualHost *:80>
    ServerName      sunahip.dev

    DocumentRoot    "/var/www/html/sunahip/web"
    DirectoryIndex  app_dev.php app.php

    <Directory "/var/www/html/sunahip/web">
        AllowOverride All
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ app.php [QSA,L]
        </IfModule>
    </Directory>

    CustomLog  logs/sunahip-access_log combined
    ErrorLog   logs/sunahip-error_log

    KeepAlive            On
    MaxKeepAliveRequests 200
    KeepAliveTimeout     5

    AddOutputFilterByType DEFLATE text/css text/plain text/html application/xhtml+xml text/xml application/xml

    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary

        ExpiresActive On
        ExpiresDefault "now plus 1 week"
        ExpiresByType image/x-icon "now plus 1 month"
        ExpiresByType image/gif    "now plus 1 month"
        ExpiresByType image/png    "now plus 1 month"
        ExpiresByType image/jpeg   "now plus 1 month"
    </IfModule>
</VirtualHost>
Was it helpful?

Solution

Disable all Firefox extensions that parse/manipulate CSS and try again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top