its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

来源:互联网 发布:软件开发公司账务处理 编辑:程序博客网 时间:2024/05/19 01:12

  今天遇到的问题,使用SpringBoot 的时候,加上 SpringSecurity 之后,页面的请求总是会报错its MIME type ('text/html') is not executable, and strict MIME type checking is enabled

Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/jquery/dist/jquery.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/bootstrap/dist/js/bootstrap.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular/angular.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-messages/angular-messages.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-ui-router/release/angular-ui-router.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-bootstrap/ui-bootstrap.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-local-storage/dist/angular-local-storage.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-animate/angular-animate.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/bootstrap-timepicker/js/bootstrap-timepicker.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-translate/angular-translate.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/angular-translate-storage-cookie/angular-translate-storage-cookie.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/static/style/bootstrap-modal/js/bootstrap-modal.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/static/style/bootstrap-modal/js/bootstrap-modalmanager.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/static/style/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/bower_components/artDialog/dist/dialog.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/static/scripts/myUtils.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/static/scripts/basePath.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login#action/login:1 Refused to execute script from 'http://127.0.0.1:8088/knight/web/login/js/loginController.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

但是加上之后呢又不存在这个题,多方查阅,最后,是SpringSecurity拦截掉了,检查自己的代码,最后发现是配置的路径不对

@Overridepublic void configure(WebSecurity webSecurity) throws Exception{    webSecurity            .ignoring()            .antMatchers("web/**");//放开所有静态资源}

改成:

@Overridepublic void configure(WebSecurity webSecurity) throws Exception{    webSecurity            .ignoring()            .antMatchers("/web/**");//放开所有静态资源}

重启,就可以了.


原创粉丝点击