且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

资源解释为样式表,但转换为MIME类型text / html(似乎与web服务器无关)

更新时间:2022-06-24 15:10:21


我想先了解问题

i'd like to start by understanding the problem

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

Browsers make HTTP requests to servers. The server then makes an HTTP response.

请求和响应都包含一堆标题和一些内容(有时是可选的)。

Both requests and responses consist of a bunch of headers and a (sometimes optional) body with some content in it.

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

If there is a body, then one of the headers is the Content-Type which describes what the body is (is it an HTML document? An image? The contents of a form submission? etc).

当您要求您的样式表时,您的服务器告诉浏览器它是一个HTML文档( Content-Type:text / css ),而不是样式表( Content-Type:text / html / p>

When you ask for your stylesheet, your server is telling the browser that it is an HTML document (Content-Type: text/html) instead of a stylesheet (Content-Type: text/css).


我已经检查过我的myme.type和text / css已经在css。

I've already checked my myme.type and text/css is already on css.

然后,你的服务器的其他东西使得样式表带有错误的内容类型。

Then something else about your server is making that stylesheet come with the wrong content type.

浏览器的开发者工具来检查请求和响应。

Use the Net tab of your browser's developer tools to examine the request and the response.