package com.bb.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsConfig implements WebMvcConfigurer{

	
	@Override
	public void addCorsMappings(CorsRegistry registry) {
		registry.addMapping("/api/**")		
		.allowedOriginPatterns("*") 
		.allowedHeaders("*") // 어떤 헤더들을 허용할 것인지 
		.allowedMethods("*") // 어떤 메서드를 허용할 것인지 (GET, POST...) 
		.allowCredentials(false) // 쿠키 요청을 허용한다(다른 도메인 서버
		.maxAge(86400);
	
		WebMvcConfigurer.super.addCorsMappings(registry);
		
	}
}
