After deploying my site to a fresh Laravel Forge server the JS and CSS files are not being loaded, they are not even being shown in the actually rendered HTML.
I’ve tried a few things already like running php artisan basset:check
, which gives me three green DONEs. I’ve even tried running php artisan backpack:install
. Locally everything works fine. Any help is much appreciated.
PHP VERSION:
PHP 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Feb 15 2024 18:38:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies
with Zend OPcache v8.3.3-1+ubuntu22.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies
LARAVEL VERSION:
- 10.43.0.0
BACKPACK PACKAGE VERSIONS:
- backpack/basset: 1.2.2
- backpack/crud: 6.6.1
- backpack/generators: v4.0.3
- backpack/permissionmanager: 7.1.1
- backpack/pro: 2.1.2
- backpack/settings: 3.1.0
- backpack/theme-coreuiv2: 1.2.3
2
Answers
This was resolved by using a different hostname. Where I previously used api-env.domain.com, I changed this to api.env.domain.com and updated the
APP_URL
accordingly. I'm not sure if the dash in the hostname is not supported, but this did the trick for me.Make sure the
APP_URL
in your .env file is correctly pointing to the URL you use to access your application in the browser.For example: https://yourdomain.com
More info available here.