participation-service WebConfig 추가

- CORS 설정 적용
- 모든 origin 패턴 허용
- 모든 HTTP 메서드 허용
- Credentials 허용
This commit is contained in:
jhbkjh 2025-10-30 10:21:08 +09:00
parent 6948b48498
commit 5cac8ccc12
2 changed files with 33 additions and 1 deletions

View File

@ -24,7 +24,7 @@ import java.util.Arrays;
@EnableWebSecurity
public class SecurityConfig {
@Value("${cors.allowed-origins:http://localhost:*,https://kt-event-marketing-api.20.214.196.128.nip.io/api/v1}")
@Value("${cors.allowed-origins:*")
private String allowedOrigins;
@Bean

View File

@ -0,0 +1,32 @@
package com.kt.event.participation.infrastructure.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Web Configuration
* CORS 설정 기타 관련 설정
*
* @author System Architect
* @since 2025-10-30
*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
/**
* CORS 설정
* - 모든 origin 허용 (개발 환경)
* - 모든 HTTP 메서드 허용
* - Credentials 허용
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600);
}
}