From 94cfe09364ac6c26ba9e8bf4d51cdbbd827f9b75 Mon Sep 17 00:00:00 2001 From: seeunjang Date: Fri, 7 Jun 2024 11:01:53 +0900 Subject: [PATCH] =?UTF-8?q?PET-312=20feat=20:=20CorsConfig=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commonmodule/config/CorsConfig.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Common-Module/src/main/java/com/pawith/commonmodule/config/CorsConfig.java diff --git a/Common-Module/src/main/java/com/pawith/commonmodule/config/CorsConfig.java b/Common-Module/src/main/java/com/pawith/commonmodule/config/CorsConfig.java new file mode 100644 index 00000000..51edc09f --- /dev/null +++ b/Common-Module/src/main/java/com/pawith/commonmodule/config/CorsConfig.java @@ -0,0 +1,19 @@ +package com.pawith.commonmodule.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("/**") + .allowedOrigins("http://localhost:5173", "https://hello-flowith.vercel.app") + .allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH") + .allowedHeaders("*"); + + } + +}