Skip to content

Commit

Permalink
HOTFIX: CORS 설정 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hyxklee committed Nov 30, 2024
1 parent ca0c347 commit b60e199
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/leets/weeth/global/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import java.util.Arrays;

import static org.springframework.security.config.Customizer.withDefaults;

@Configuration
Expand Down Expand Up @@ -95,11 +97,10 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
public CorsConfigurationSource source() {
CorsConfiguration configuration = new CorsConfiguration();

configuration.addAllowedOriginPattern("http://localhost:3000");
configuration.addAllowedMethod("*");
configuration.addAllowedHeader("*");
configuration.addExposedHeader("Authorization");
configuration.addExposedHeader("Authorization_refresh");
configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PATCH", "DELETE"));
configuration.setAllowedHeaders(Arrays.asList("*"));
configuration.setExposedHeaders(Arrays.asList("Authorization, Authorization_refresh"));
configuration.setAllowCredentials(true);

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
Expand Down

0 comments on commit b60e199

Please sign in to comment.