Unpkg serves CSS with correct mime type for direct hit but text/css when referenced from html page

299 Views Asked by At

I have read numerous questions with a similar trouble but they usually were caused by a server misconfiguration. I use unpkg.com service so I assume it is configured correctly.

My HTML5 static page contains:

<link rel="stylesheet" type="text/css" href="https://unpkg.com/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css">

My app is written in Vue but that code is still present in generated file.

Chrome shows the following warnings:

Resource interpreted as Stylesheet but transferred with MIME type text/plain: "https://unpkg.com/bootstrap/dist/css/bootstrap.min.css".

Here is the response caught by Network tab in Developer tools. Content type is text/plain

enter image description here

And the second redirected request with text/css:

enter image description here

When I enter this URL in Chrome location bar, I receive 302 status code first having the text/plain mime type first and the second fetch is expected text/css.

Is this sort of Chrome bug that it complains about the content type of request to be redirected? Or is it unpkg.com error? Is there a way to get rid off these errors (I can bundle the file in my Vue app but I want to minimize the transfers).

You can try it live here: https://beta.mezinamiridici.cz/ankety/jizda-v-tesnem-zavesu-za-kamionem

0

There are 0 best solutions below