diff --git a/src/main/java/com/finut/finut_server/config/CorsMvcConfig.java b/src/main/java/com/finut/finut_server/config/CorsMvcConfig.java index fa2c5bb..6f1a7fb 100644 --- a/src/main/java/com/finut/finut_server/config/CorsMvcConfig.java +++ b/src/main/java/com/finut/finut_server/config/CorsMvcConfig.java @@ -10,7 +10,7 @@ public class CorsMvcConfig implements WebMvcConfigurer { public void addCorsMappings(CorsRegistry corsRegistry) { corsRegistry.addMapping("/**") .allowedOrigins("http://localhost:3000") - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD") + .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD") .allowedHeaders("Authorization", "Content-Type") .exposedHeaders("Authorization") .allowCredentials(true); diff --git a/src/main/java/com/finut/finut_server/config/SecurityConfig.java b/src/main/java/com/finut/finut_server/config/SecurityConfig.java index 3c9206d..730ac55 100644 --- a/src/main/java/com/finut/finut_server/config/SecurityConfig.java +++ b/src/main/java/com/finut/finut_server/config/SecurityConfig.java @@ -60,8 +60,7 @@ public CustomOAuth2UserService customOAuth2UserService(UsersRepository userRepos @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000")); // 프론트엔드 도메인 - configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD")); // 허용할 HTTP 메서드 + configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "http://ec2-15-165-175-91.ap-northeast-2.compute.amazonaws.com:8080")); configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD")); // 허용할 HTTP 메서드 configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type")); // 허용할 헤더 configuration.setExposedHeaders(Arrays.asList("Authorization")); // 응답에서 노출할 헤더 configuration.setAllowCredentials(true); // 자격 증명 포함 요청 허용