Skip to content

Commit

Permalink
Merge pull request #24 from 9oormthon-univ/dev
Browse files Browse the repository at this point in the history
[#2]🐛Fix: CORS 수정
  • Loading branch information
sumin220 authored Nov 22, 2024
2 parents 14a580a + 9712c82 commit 035357c
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.formLogin(AbstractHttpConfigurer::disable)
.httpBasic(AbstractHttpConfigurer::disable)

// iframe 차단
.headers(header -> header.frameOptions(
HeadersConfigurer.FrameOptionsConfig::sameOrigin
))
// // iframe 차단
// .headers(header -> header.frameOptions(
// HeadersConfigurer.FrameOptionsConfig::sameOrigin
// ))

// session 사용 중지
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
Expand Down Expand Up @@ -99,15 +99,15 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.build();
}

@Value("${cors.allowed-origins:http://localhost:3000}")
private List<String> allowOriginList;
// @Value("${cors.allowed-origins")
// private List<String> allowOriginList;

@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(allowOriginList); // 허용할 Origin 추가
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
configuration.setAllowedHeaders(List.of("*"));
configuration.addAllowedOrigin("http://localhost:3000"); // 클라이언트 주소
configuration.addAllowedMethod("*");
configuration.addAllowedHeader("*");
configuration.setAllowCredentials(true);
configuration.addExposedHeader("Authorization");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
Expand Down

0 comments on commit 035357c

Please sign in to comment.