@Configuration
public class CorsConfig {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.setAllowedOrigins(List.of("http://localhost:5173"));
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
config.setAllowedHeaders(List.of("*"));
config.setExposedHeaders(List.of("*"));
config.setExposedHeaders(List.of("*", "Location"));// 이부분을 수정
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return source;
}
}
진짜 별거없다 "*"만 하면 Location이 안나오는 문제가 생길 수 있어 Location을 넣어주니 나오더라
'트러블 슈팅' 카테고리의 다른 글
CSP오류 해결 (0) | 2024.02.01 |
---|---|
리액트 셋팅에 관련된 것 (0) | 2024.02.01 |
@QueryProjection의 Q객체 인식못함오류 (0) | 2024.01.23 |
MapStruct 맵핑 못하는 문제 (0) | 2024.01.04 |
ids for this class must be manually assigned before calling save(): (0) | 2024.01.03 |