프로젝트

[SpringBoot 설정] CORS 허용 설정

nineDeveloper 2020. 6. 20.
728x90
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**") //** 하면 전부다 허용
                .allowedOrigins("*")
                .allowedMethods(HttpMethod.POST.name(), HttpMethod.GET.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name())
                .allowCredentials(false)
                .allowedHeaders("*")
                .maxAge(3600);
    }
}
728x90

댓글

💲 추천 글