package kr.re.etri.autoflow.common ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.http.HttpMethod ;
import org.springframework.web.servlet.config.annotation.CorsRegistry ;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry ;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer ;
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
@Override
public void addCorsMappings ( CorsRegistry registry ) {
registry . addMapping ( "/**" )
. allowedOriginPatterns ( "http://localhost:3000" , "http://localhost:5173" , "http://127.0.0.1:3000" , "http://127.0.0.1:5173" , "http://10.10.11.144" , "http://cuuva.com:2481" , "http://210.217.121.58:2481" , "http://aisw.openlivinglab.kr:20001" , "http://10.55.15.92" ) // 허용할 Origin 지정
. allowedMethods ( "GET" , "POST" , "PUT" , "DELETE" , "OPTIONS" )
. allowedHeaders ( "*" ) // 필요하면 "cuuva-jwt", "Content-Type", "Authorization" 명시 가능
. exposedHeaders ( "cuuva-jwt" )
//.allowCredentials(true)
. maxAge ( 3600 ) ;
}
@Override
public void addInterceptors ( InterceptorRegistry registry ) {
registry . addInterceptor ( new LoggingInterceptor ( ) )
. addPathPatterns ( "/**" ) ; // Intercepts all requests
}
}