|
|
|
|
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://10.10.11.144", "http://cuuva.com:2481") // 허용할 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
|
|
|
|
|
}
|
|
|
|
|
}
|