[Spring boot] Refused to execute script from 'http://localhost:~~~' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

유존돌돌이·2022년 2월 25일
0

Spring boot

목록 보기
16/20
post-thumbnail

스프링 시큐리티 config 세팅 후 테스트를 진행하려 하는데 제목과 같은 에러가 발생되었다.

Refused to execute script from 'http://localhost:8000/auth/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

개발자도구 -> Network에서
action을 눌렀을때 js에서 Controller로 가야하는데,
js가 Spring Security Config 세팅에 js접근 권한을 주지 않아
계속 로그인 페이지를 불러오려고 했다.

1.join : 200
2.user.js : 302 error
3.login : 200

뭘 빼먹었나 보았더니 Join 완료 후 접근하는 index(root경로)를 permitAll에 추가를 안해줬었다.

http
.authorizeHttpRequests()
.antMatchers("/", "/auth/**") // "/" 추가
.permitAll()

0개의 댓글