@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.addAllowedMethod("*");
configuration.addAllowedHeader("*");
configuration.addExposedHeader("Authorization");
configuration.addAllowedOriginPattern("http://amorossoprc.shop/"); // 배포 전 모두 허용 -> 도메인으로 변경!
configuration.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
그 중에서도 프론트와 백 모두 Credential을 allow 해줘야만 서버에서 보낸 JSESSIONID 쿠키가 클라이언트에 저장된다. 저장되지 않는다.
저장되는 줄 알았는데 저장되지 않는다. 다음 게시글에 해당 내용을 정리할 예정이다.😥
오늘 하루 종일 CORS 오류만 본 것 같다.
이래서 JWT로 구현하는 방식을 많이들 사용하는 것 같다.
(설정해줄게 꽤나 많음..)
아직 쓰고 싶은 말이 많은데 너무 졸립다..
내일도 잘 버텨보자.. 화이팅...