Skip to content Skip to sidebar Skip to footer

Resource Blocked Due To Mime Type Mismatch (x-content-type-options: Nosniff)

I am developing a web page using JavaScript and HTML, everything was working good when I have received this list of errors from my HTML page: The resource from “https://raw.githu

Solution 1:

Check if the file path is correct and the file exists - in my case that was the issue - as I fixed it, the error disappeared

Solution 2:

This can be fixed by changing your URL to use a mirror/proxy. Instead of using GitHub:

https://raw.githubusercontent.com/svnpenn/bm/master/yt-dl/yt-dl.js
Content-Type: text/plain; charset=utf-8

Use a third-party cache:

https://cdn.rawgit.com/svnpenn/bm/master/yt-dl/yt-dl.js
content-type: application/javascript;charset=utf-8

rawgit.comwas a caching proxy service for GitHub that has shut down since 2018. See its FAQ

Solution 3:

We started facing this error in production after our devops team changed the webserver configuration by adding X-Content-Type-Options: nosniff. Now, due to this, browser was forced to interpret the resources as it was mentioned in content-type parameter of response headers.

Now, from the beginning, our application server was explicitly setting content-type of the js files as text/plain. Since, X-Content-Type-Options: nosniff was not set in webserver, browser was automatically interpreting the js files as JavaScript files although the content-type was mentioned as text/plain. This is called as MIME-sniffing. Now, after setting X-Content-Type-Options: nosniff, browser was forced to not do the MIME-sniffing and take the content-type as mentioned in response headers. Due to this, it did interpret js files as plain text files and denied to execute them or blocked them. The same is shown in your errors.

Answer : is to make your server set the content-type of JS files as

application/javascript;charset=utf-8

This way, it will load all JS files normally and issue will get resolved.

Solution 4:

check your path ,this error will come if file was not exist into given path.

Solution 5:

Are you using express?

Check your path(note the "/" after /public/):

app.use(express.static(__dirname + "/public/"));

//note: you do not need the "/" before "css" because its already included above:

rel="stylesheet" href="css/style.css

Hope this helps

Post a Comment for "Resource Blocked Due To Mime Type Mismatch (x-content-type-options: Nosniff)"