對於錯誤“Refused to execute script from '...' because its MIME type ('') is not executable, and strict MIME type checking is enabled.”的處理。


今天在是用公司的報表插件Stimulsoft時發現的問題。之前可以正常使用,突然不能加載了。查看發現得到這個錯誤。

查看請求頭

可以看到,請求正常響應,但是發現 Content-Type是空的,但是引入了X-Content-Type-Options。

X-Content-Type-Options 響應首部相當於一個提示標志,被服務器用來提示客戶端一定要遵循在 Content-Type 首部中對  MIME 類型 的設定,而不能對其進行修改。這就禁用了客戶端的 MIME 類型嗅探行為,換句話說,也就是意味着網站管理員確定自己的設置沒有問題。 

查詢之后,發現是最近在web.xml中加入了HttpHeaderSecurityFilter導致的。

<filter> <filter-name>httpHeaderSecurity</filter-name> <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class> <async-supported>true</async-supported> </filter> 

那么禁用這個特性,需要修改為

<filter> <filter-name>httpHeaderSecurity</filter-name> <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class> <async-supported>true</async-supported> <init-param> <param-name>blockContentTypeSniffingEnabled</param-name> <param-value>false</param-value> </init-param> </filter> 

 

 

參考鏈接  http://www.jackieathome.net/archives/369.html?utm_source=tuicool&utm_medium=referral

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 spring security中前端訪問Refused to execute script from 'http://localhost:8080/' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. Refused to execute script from '....js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.md [WEB]對於"Refused to execute script from 'http://xx.xx.xx/yy/zz.js' because its MIME type ('') is not executable, and strict MIME type checking is enabled."問題的解決辦法 Refused to apply style from '.../bootstrap.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. 瀏覽器報錯 Refused to apply style from 'http://******' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. 關於使用Django項目Google瀏覽器報錯because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. layer報錯Refused to apply style from 'http://192.168.101.12:5502/skin/layer.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled的解決方法 because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checkin because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checkin HTML5 because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME c
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM