I have a Laravel 11 app in a docker container that fails to load the styles.css file from Spaite's Media Library Pro.
The URL it calls for is:
Request URL: http://localhost/media-library-pro/styles.css
. <- incorrect
The referrer however is correct:
Referrer: /
<- correct
How do I fix that? All other resources load fine.
In the .env I have: APP_URL=
and that's what I access the project with. I also have the APP_ENV=local
set.
I've run:
php artisan config:clear
and php artisan config:cache
and php artisan storage:link
The output of echo config('app.url');
is:
The rest of Media library pro works fine, images upload and previews display.
What else can I do or check to see where it's getting http://localhost from?
The controller that outputs the link is:
class MediaLibraryStylesController
{
public function __invoke()
{
// $styles = File::get(__DIR__ . '../resources/js/media-library-pro-styles/dist/styles.css');
$styles = File::get(__DIR__.'/../../../resources/js/media-library-pro-styles/dist/styles.css');
$contents = <<<html
$styles
html;
return response()->make($contents)->header('Content-Type', 'text/css');
}
}
The styles.css file is in that location.
I have a Laravel 11 app in a docker container that fails to load the styles.css file from Spaite's Media Library Pro.
The URL it calls for is:
Request URL: http://localhost/media-library-pro/styles.css
. <- incorrect
The referrer however is correct:
Referrer: http://local.myproject/
<- correct
How do I fix that? All other resources load fine.
In the .env I have: APP_URL=http://local.myproject
and that's what I access the project with. I also have the APP_ENV=local
set.
I've run:
php artisan config:clear
and php artisan config:cache
and php artisan storage:link
The output of echo config('app.url');
is: http://local.myproject
The rest of Media library pro works fine, images upload and previews display.
What else can I do or check to see where it's getting http://localhost from?
The controller that outputs the link is:
class MediaLibraryStylesController
{
public function __invoke()
{
// $styles = File::get(__DIR__ . '../resources/js/media-library-pro-styles/dist/styles.css');
$styles = File::get(__DIR__.'/../../../resources/js/media-library-pro-styles/dist/styles.css');
$contents = <<<html
$styles
html;
return response()->make($contents)->header('Content-Type', 'text/css');
}
}
The styles.css file is in that location.
Share Improve this question asked Nov 20, 2024 at 3:25 polycodepolycode 2352 silver badges12 bronze badges1 Answer
Reset to default 0Ugh. This must've been a view cache issue.
I deleted the @mediaLibraryStyles
blade directive, viewed the site, added it back and this time the url was correct.