Skip to content

Commit

Permalink
feat: cors 헤더 전체 허용
Browse files Browse the repository at this point in the history
  • Loading branch information
f1v3-dev committed Oct 24, 2024
1 parent 0d954bf commit 6468737
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
protected CorsConfigurationSource corsConfigurationSource() { // 추후 CORS 수정 필요
CorsConfiguration config = new CorsConfiguration();
config.setAllowedOrigins(List.of(jjakkakProperties.getFrontUrl(), "http://localhost:5173")); // 허용할 도메인 명시
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
config.setAllowedHeaders(List.of("Authorization", "Content-Type", "Access-Control-Allow-Headers", "Access-Control-Expose-Headers", "_retry"));
config.addAllowedHeader("*");
config.addAllowedMethod("*");

// config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
// config.setAllowedHeaders(List.of("Authorization", "Content-Type", "Access-Control-Allow-Headers", "Access-Control-Expose-Headers", "_retry"));

config.addExposedHeader("Authorization"); //프론트에서 해당 헤더를 읽을 수 있게
config.setAllowCredentials(true);

Expand Down

0 comments on commit 6468737

Please sign in to comment.