From aecc174628091789b183fb7241275f57fb952fdf Mon Sep 17 00:00:00 2001 From: 70825 Date: Tue, 1 Aug 2023 13:52:45 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20cors=EB=A5=BC=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=ED=95=98=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/com/funeat/common/WebConfig.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/src/main/java/com/funeat/common/WebConfig.java b/backend/src/main/java/com/funeat/common/WebConfig.java index b72556759..69a7a81be 100644 --- a/backend/src/main/java/com/funeat/common/WebConfig.java +++ b/backend/src/main/java/com/funeat/common/WebConfig.java @@ -4,7 +4,9 @@ import java.util.List; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; +import org.springframework.http.HttpHeaders; import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @@ -29,4 +31,12 @@ public void addArgumentResolvers(List resolvers) resolvers.add(customPageableHandlerMethodArgumentResolver); resolvers.add(authArgumentResolver); } + + @Override + public void addCorsMappings(final CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .exposedHeaders(HttpHeaders.LOCATION); + } }