AriaNg
AriaNg copied to clipboard
建议在引用静态资源时加上正确的 MIME type?
部署在服务端, AriaNg 1.1.0
Nginx 开启 add_header X-Content-Type-Options "nosniff" always;
后导致浏览器拒绝加载静态资源的错误, 具体看 console 提示:
Creating Application Cache with manifest https://example.com/aria2/index.manifest
example.com/:1 Application Cache Checking event
example.com/:1 Application Cache Downloading event
example.com/:1 Refused to apply style from 'https://example.com/aria2/css/bootstrap-3.4.1.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
example.com/:1 Refused to apply style from 'https://example.com/aria2/css/plugins-acd93e5a25.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
example.com/:1 Refused to apply style from 'https://example.com/aria2/css/aria-ng-2a46099f8c.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
example.com/:1 GET https://example.com/aria2/js/angular-packages-1.6.10.min.js net::ERR_ABORTED 404
example.com/:1 Application Cache Progress event (0 of 12) https://example.com/aria2/css/aria-ng-2a46099f8c.min.css
example.com/:1 Application Cache Error event: Resource fetch failed (404) https://example.com/aria2/css/aria-ng-2a46099f8c.min.css
我查了下可能是 index.html 在引用这些资源时没有正确指定 MIME type 然后 fallback 到 text/html 导致服务端开了 nosniff 后 MINE type 不匹配而拒绝加载.
你来提mr吧