I'm trying to install a Symfony 3.1.4 project on a managed server. It works perfectly on my local machine, but not on the external.
For JS routing I use FOSJsRoutingBundle, version ^1.6.
Problem:
When I visit http://mydomain.tld, the browser tries to load http://mydomain.tld/bundles/fosjsrouting/js/router.js, but is not allowed to: 403 Forbidden.
For my understanding the file exists, but I'm not allowed to load it.
Solving approach:
php bin/console cache:clear --env=prodphp bin/console fos:js-routing:dumpphp bin/console assets:install --symlink web- chmod for
web/bundles/*: 755
Nothing worked.
Could it be related to the symlinks? I'm a bit lost and. Any ideas?
Thanks in advance!
Edit 1: security.yml
security:
providers:
in_memory:
memory: ~
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
remember_me:
secret: '%secret%'
lifetime: 604800
path: /
pattern: ^/
form_login:
provider: fos_userbundle
login_path: fos_user_security_login
check_path: fos_user_security_check
csrf_token_generator: security.csrf.token_manager
logout:
path: fos_user_security_logout
target: index
anonymous: true
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /admin/, role: ROLE_ADMIN }
- { path: /dashboard, role: ROLE_USER }
I recently had this issue and this is what worked for me in Symfony 3.4:
In
config.yml, you need to add a package to the assets config with thebase_pathset to/bundles. This makes the route public and should allow you to pull any asset file from any bundle installed. Of course, you can instead add a package per bundle if you wish to do so.config.yml