[ CS Study ] CORS Problem

이승렬·2023년 7월 19일

[Spring]

목록 보기
9/15
post-thumbnail

#1. 해결방법

Servlet Filter를 사용하여 커스텀한 Cors 설정하거나, WebMvcConfiguer를 구현한 Configuration 클래스를 만들어서 addCorsMappings()를 재정의할 수도 있고,

마지막으로 Spring Security에서 CorsConfigurationSource를 Bean으로 등록하고 config에 추가해줌으로써 해결할 수 있습니다.

Controller 클래스에 @Crossorigin 어노테이션을 통해 해결할 수 있습니다.

profile
Backend_Developer

1개의 댓글

comment-user-thumbnail
2023년 7월 19일

이 글을 읽고 많이 배웠습니다.

답글 달기