Skip to content

Commit

Permalink
Merge pull request #73 from APPS-sookmyung/dev
Browse files Browse the repository at this point in the history
[Fix] CORS 오류 수정
  • Loading branch information
ajung7038 authored Aug 29, 2024
2 parents 0a93bb9 + b18d25b commit 06627b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/WELLET/welletServer/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ public class SecurityConfig {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.addAllowedOrigin(allowedOrigin); // 허용할 origin 설정
configuration.addAllowedOrigin("http://localhost:5173");
configuration.addAllowedOrigin(allowedOrigin);
configuration.addAllowedMethod("*"); // 모든 HTTP 메소드 허용
configuration.addAllowedHeader("*"); // 모든 헤더 허용
configuration.setAllowCredentials(true); // 쿠키 허용

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration); // 모든 경로에 대해 위 설정 적용
source.registerCorsConfiguration("/**", configuration);
return source;
}

Expand All @@ -46,8 +47,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(request -> {
request.requestMatchers(
// antMatcher("/health")
antMatcher("/**")
antMatcher("/health")
// antMatcher("/**")
).permitAll()
.anyRequest().authenticated();
});
Expand Down

0 comments on commit 06627b0

Please sign in to comment.