Skip to content

Commit

Permalink
refactor: allow Origins 중복 설정 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchef1 committed May 12, 2024
1 parent baeabc8 commit 1df29db
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ public class CorsMvcConfig implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry corsRegistry) {

corsRegistry.addMapping("/**")
.allowedOrigins("http://localhost:3000")
.allowedOrigins("https://sanbosillok.vercel.app");
.allowedOrigins("http://localhost:3000", "https://sanbosillok.vercel.app");
}
}
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;

import java.util.Arrays;
import java.util.Collections;

@Configuration
@@ -29,8 +30,7 @@ private static void corsAllow(CorsConfigurer<HttpSecurity> corsCustomizer) {
CorsConfiguration configuration = new CorsConfiguration();

configuration.setAllowedMethods(Collections.singletonList("*"));
configuration.setAllowedOrigins(Collections.singletonList("http://localhost:3000"));
configuration.setAllowedOrigins(Collections.singletonList("https://sanbosillok.vercel.app"));
configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "https://sanbosillok.vercel.app"));
configuration.setAllowedHeaders(Collections.singletonList("*"));
configuration.setAllowCredentials(true);
configuration.setMaxAge(3600L);

0 comments on commit 1df29db

Please sign in to comment.