对于错误“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