diff --git a/src/main/java/com/example/letscareer/common/config/WebConfig.java b/src/main/java/com/example/letscareer/common/config/WebConfig.java new file mode 100644 index 0000000..c758931 --- /dev/null +++ b/src/main/java/com/example/letscareer/common/config/WebConfig.java @@ -0,0 +1,21 @@ +package com.example.letscareer.common.config; + +import lombok.RequiredArgsConstructor; +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.WebMvcConfigurer; + +@Configuration +@RequiredArgsConstructor +public class WebConfig implements WebMvcConfigurer { + @Override + public void addCorsMappings(final CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("*") + .allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name()) + .allowedHeaders("Authorization", "Content-Type") + .allowCredentials(true) + .maxAge(3000); + } +} \ No newline at end of file