공부용/SpringBoot
refused to execute script from *** because its mime type (‘text/html’) is not executable 오류 발생 시
엑스포스
2022. 11. 23. 18:38
반응형
refused to execute script from *** because its mime type (‘text/html’) is not executable 오류 발생 시
<script type="text/javascript" src="http://localhost/pay/jsForm"></script>
개발 중 위와 같이 서버에서 생성한 파일을 스크립트로 선언하는 부분이 있었는데
아래와 같은 오류가 발생했다
Refused to execute script from 'http://localhost/pay/jsForm' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
처음에는 크롬에서 차단하는건가 생각했지만, 찾아보니 단순한 이유였다.
Spring Security에서 접근을 차단하고 있었던 것으로
아래 인증을 무시하도록 설정해주니 정상적으로 동작되었다.
@Configuration
@EnableWebSecurity
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
.
.
.
.
.
@Override
public void configure(WebSecurity web) throws Exception {
// Spring Security가 인증을 무시할 경로 설정
web.ignoring().antMatchers("/pay/jsForm");
}
}
반응형