admin管理员组文章数量:1335584
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.
本文标签: Laravel 11 media library stylescss link incorrectStack Overflow
版权声明:本文标题:Laravel 11 media library styles.css link incorrect - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742384365a2464729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论