加载资源失败:加载 Laravel css 文件时出现 net::ERR_CONTENT_DECODING_FAILED 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53538607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to load resource: net::ERR_CONTENT_DECODING_FAILED error while loading laravel css file
提问by jeevanreddy
While executing a web page after loading HTML, CSS file is not loading & not applying the UI changes.
在加载 HTML 后执行网页时,CSS 文件未加载且未应用 UI 更改。
In browser console it is showing the following error Failed to load resource: net::ERR_CONTENT_DECODING_FAILED
在浏览器控制台中,它显示以下错误未能加载资源:net::ERR_CONTENT_DECODING_FAILED
One more issue is "that error is occuring only for the first time", If I reload the page the error will be gone & will load the CSS properly.
另一个问题是“该错误仅在第一次发生”,如果我重新加载页面,错误将消失并正确加载 CSS。
One solution I found after browsing is to enable gzip encoded, That is already in place.
我在浏览后发现的一个解决方案是启用 gzip 编码,这已经就位。
回答by Scott Chambers
Welcome to stackoverflow. This is a bit of an annoying error. But ill do my best Lacking what information I have on your error exactly.
欢迎使用 stackoverflow。这是一个有点烦人的错误。但是我会尽力而为 缺乏我对您的错误的确切信息。
What is this error?
这是什么错误?
This can happen when an HTTP request's headers say that the content is gzip encoded, but it isn't. It doesn't always happen, as you've discovered. But happens occasionally.
当 HTTP 请求的标头说内容是 gzip 编码的,但事实并非如此时,就会发生这种情况。正如您所发现的那样,它并不总是发生。但偶尔会发生。
What can you do?
你能做什么?
- Check to see if Route::get('/') pointing to the correct controller/code?
- check to see if
output_compression
is added to yourphp.ini
Add this code:zlib.output_compression = On
- try going to
/config/config.php
(this may not be right in your case) and set the following to false$config['compress_output'] = FALSE;
- 检查 Route::get('/') 是否指向正确的控制器/代码?
- 检查是否
output_compression
已添加到您的php.ini
添加此代码中:zlib.output_compression = On
- 尝试去
/config/config.php
(这可能不适合您的情况)并将以下设置为 false$config['compress_output'] = FALSE;
Further reading
进一步阅读
(more about what the error actually is)
(更多关于错误实际上是什么)
https://superuser.com/questions/172951/chrome-error-330-neterr-content-decoding-failed
https://superuser.com/questions/172951/chrome-error-330-neterr-content-decoding-failed
https://www.solvusoft.com/en/errors/runtime-errors/google-inc/google-chrome/330-chrome-error-330/
https://www.solvusoft.com/en/errors/runtime-errors/google-inc/google-chrome/330-chrome-error-330/
回答by Hari17
As I referred about this cause of error, I think adding zlib.output_compression = On
to php.ini
will help you.
正如我提到的这个错误原因,我认为添加zlib.output_compression = On
到php.ini
会帮助你。
You can find this php.ini
file in your php installed folder. In that find zlib.output_compression
and initially it will be in OFF
stage. Change it to zlib.output_compression = On
.
你可以php.ini
在你的 php 安装文件夹中找到这个文件。在那个发现中zlib.output_compression
,最初它将处于OFF
阶段。将其更改为zlib.output_compression = On
.
For more information you can refer https://stefantsov.com/fixing-err_content_decoding_failed-in-apachephp/
有关更多信息,您可以参考https://stefantsov.com/fixing-err_content_decoding_failed-in-apachephp/