我有这个问题。Chrome继续返回此错误

资源解释为样式表,但以MIME类型text/html传输

受此错误影响的文件只有Style、chosen和jquery-gentleselect(以相同方式导入索引的其他CSS文件工作良好且没有错误)。我已经检查了我的MIME类型和文本/css已经在css上。

老实说,我想从理解问题开始(这似乎是我一个人做不到的事情)。


当前回答

I faced the same issue while configuring Postfix Admin 3.2. According to the official documentation, the whole Postfix Admin content should be extracted into a separate directory, i.e. /srv/postfixadmin and not the document root. Only the /srv/postfixadmin/public directory should be symlinked into /var/www/html document root. I have just extracted the whole content into /var/www/html. Having played with Nginx server block settings, I managed example.com/postfixadmin resolving from /var/www/html/postfixadmin/public. Nevertheless, images and CSS were not available with 404 status code. The stylesheets were broken. I got the error message OP quoted with respective 404 entries in access log.

在我的情况下,我只是移动/var/www/html/postfixadmin到/srv/postfixadmin和ln -s /srv/postfixadmin/公共/var/www/html/postfixadmin。这完全解决了问题。 这是参考资料。

其他回答

我想从理解问题开始

浏览器向服务器发出HTTP请求。然后服务器做出一个HTTP响应。

请求和响应都由一堆头部和一个(有时是可选的)包含一些内容的主体组成。

如果有一个主体,那么其中一个头是Content-Type,它描述了主体是什么(它是HTML文档吗?一个图像?表单提交的内容?等等)。

当您请求样式表时,服务器会告诉浏览器这是一个HTML文档(Content-Type: text/ HTML),而不是一个样式表(Content-Type: text/css)。

我已经查过了。Type and text/css已经在css上了。

那么,您的服务器的其他部分使样式表具有错误的内容类型。

使用浏览器开发人员工具的Net选项卡检查请求和响应。

我开始得到这个问题今天只在chrome和safari相同的项目/url为我的goormide容器(node.js)

在尝试了上面的几个建议之后,它们似乎不起作用,并且回溯了我从昨天到今天所做的一些代码更改,这也没有什么区别,我最终在chrome设置中单击:

1.设置;

2.向下滚动至底部,选择:“高级”;

3.向下滚动到底部,选择:“恢复设置到原始默认值”;

这似乎已经解决了这个问题,因为我不再在控制台中得到警告/错误,页面显示为它应该。阅读上面的帖子,似乎这个问题可以从任何数量的来源发生,所以设置重置是一个潜在的通用修复。 干杯

以防有人来到这个帖子,有类似的问题。我也遇到过类似的问题,但是解决方法很简单。

一名开发人员错误地丢失了一份网页副本。将config文件放到CSS目录下。删除后,所有错误都得到解决,页面正常显示。

使用ReactJs,当我添加样式文件到index.html使用相对链接,如

<link rel="stylesheet" href="./css/style.css"> .

然后我导航到一条路线,说;localhost:3000/artist和刷新,我得到错误。

错误消失后,我取代相对链接与绝对链接说;

<link rel=“stylesheet” href=“http://localhost/project/public/css/style.css”。

I faced the same issue while configuring Postfix Admin 3.2. According to the official documentation, the whole Postfix Admin content should be extracted into a separate directory, i.e. /srv/postfixadmin and not the document root. Only the /srv/postfixadmin/public directory should be symlinked into /var/www/html document root. I have just extracted the whole content into /var/www/html. Having played with Nginx server block settings, I managed example.com/postfixadmin resolving from /var/www/html/postfixadmin/public. Nevertheless, images and CSS were not available with 404 status code. The stylesheets were broken. I got the error message OP quoted with respective 404 entries in access log.

在我的情况下,我只是移动/var/www/html/postfixadmin到/srv/postfixadmin和ln -s /srv/postfixadmin/公共/var/www/html/postfixadmin。这完全解决了问题。 这是参考资料。