Dashoard not loading - invalid assets path generated when using symlinks
Overview
I've just installed 5.43.2 on my local machine and it appears CiviCRM is not resolving SOME assets paths correctly.
At first I thought that it's related to the project placement as my Drupal was available at the dev.test/drupal
path (it needs to be there for one of my projects) - but even after I've moved the project to the domain's root (dev.test
) it's still spilling server paths in the urls generating invalid assets urls in result.
The project files are located at /vagrant/drupal
on the server
All of this results in empty dashboard page as some of the js/css files are not loaded. Other CiviCRM pages load semi-correctly but are missing some assets (css/js files) and in result look incomplete/broken
edit: What I found out is that this is only happening if the project is symlinked
I've got the project located at /vagrant/drupal
and this dir is symlinked as /var/www/public
and later that symlink is served by apache.
Serve the project directly from the /vagrant/drupal
then the issue is not occurring.
Not using the symlink is not a solution here.
The issue is not existing on CiviCRM 5.12
Reproduction steps
- Install CiviCRM 5.42/5.43.2
- Site symlink must be served by the server instead of the real directory
- Visit the admin dashboard
- (Optionally) Check the browser's console for errors
- (Optionally) Check the HTML source for invalid path's
Current behaviour
Expected behaviour
- CiviCRM assets paths are resolved correctly,
- No server paths are visible in the HTML source code
- Assets are loaded correctly
- Dashboard page is working correctly
Environment information
- Browser: ANY
- CiviCRM: 5.43.2/5.42
- PHP: 7.2/7.3
- CMS: Drupal 7.67
- Database: MySQL 5.7.7
- Web Server: Apache 2.4
Comments
This is a fresh install of both Drupal 7 and CiviCRM but I got this issue after upgrading the CiviCRM to 5.42 on my client's server so I started to investigate.
Page was working fine before the upgrade from CiviCRM 5.12 - It was an long overdue upgrade.
Installed 5.12 again locally, it's working just fine, no errors or anything so this must be something with the newer versions