JS 和 CS 文件由于 MIME 类型不匹配而被阻止

问题描述 投票:0回答:0

这是我的第一个问题,如有错误请见谅。当我登录在前端使用 angular JS 并在 jBoss 服务器上运行的应用程序的 URL 时,JS 和 CSS 文件正在加载状态 200 但我仍然遇到文件未执行的错误,我已更换出于隐私目的带有文本 URL 的原始 URL:

在 chrome 浏览器中:

Refused to apply style from 'URL/bootstrap-glyphicons.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Refused to execute script from 'URL/angular.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

火狐浏览器:

The resource from “URL/bootstrap.min.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

The resource from “URL/angular-route.min.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

我们在设置标头的 URL 和 App 服务器之间使用 Web 服务器。标题 X-Content-Type-Options: nosniff 已设置。我在应用服务器级别找不到与此相关的任何设置。我无法理解为什么 MIME 类型作为文本/html 返回。我检查了网络选项卡中的每个资源,内容类型有时显示为应用程序/javascript; charset=UTF-8 用于 JS 文件,有时它显示为 text/html;字符集=UTF-8

angularjs jboss7.x mime-types content-type x-content-type-options
© www.soinside.com 2019 - 2024. All rights reserved.