question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resource blocked due to MIME type mismatch

See original GitHub issue

I’m submitting a…

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
[ ] Other

Current behavior

I’m trying a simple bootstrap template. No JS and CSS are loaded because error: “Resource «http://127.0.0.1:5500/css/dashboard.css» blocked due to MIME type mismatch («text/html») (X-Content-Type-Options: nosniff)”

I tried following this advice, however errors are gone and no CSS/JS are loaded. Opening the same “test” page in browser without live-server works and renders fine.

This is how I include CSS:

<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" >

Environment

Browser:
- [x] Firefox version 68

For Tooling issues:

- Live Server: 5.6.1
- Platform:  Windows 10
- Visual Studio Code: vsCodium 1.38.1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

2reactions
MeirionHughescommented, Feb 13, 2020

I had this. The problem is the live server isn’t serving relative to the index.html, its doing it relative to the workspace / package. i.e. I have

 /packages/foo/dist/index.html
 /packages/foo/dist/css/bar.css

open index.html while vscode is open on the root folder and the browser will error that files are incorrect or it can’t find js scripts. Temporary solution is to open vscode directly onto the /dist folder, start the live-server and then it will work fine.

2reactions
pvrooyencommented, Nov 28, 2019

The problem is live-server is serving css with content-type incorrectly set as text/html instead of text/css. Go to networks tab (In Chrome dev tools). Click on one of the red .css files that failed to load. Click on Response Headers and confirm Content-Type: text/html; charset=utf-8 (which is incorrect)

Update: On further investigation I have noticed that my paths when linking the CSS was incorrect. So check your paths. The fact that live-server is trying to serve something with an incorrect type still means this is a possible bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resource blocked due to MIME type mismatch (X-Content ...
js. You can try to directly request the script file (copying and pasting url) and see if you can retrieve it. You can...
Read more >
Resource blocked due to MIME type mismatch (X ... - YouTube
JavaScript : Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff) [ Gift : Animated Search Engine ...
Read more >
Js file blocked due to MIME type (“text/html”) mismatch (X ...
The problem is NodeJS doesn't render HTML pages like other servers do, we have to specify the path for static files (such as...
Read more >
X-Content-Type-Options - Cloudflare Community
The resource from “https://(website domain).com/” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). We are ...
Read more >
Blocked due to MIME type mismatch [#3275328] | Drupal.org
Browser error: "The resource from “https://xxxxxxx.com/libraries/colorbox/jquery.colorbox-min.js?v=9.3.9” was blocked due to MIME type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found