From 56910317c5d08283cf29f1b8c1c22d35bcc126f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=ED=98=84=EC=9A=B1?= Date: Tue, 3 Feb 2026 21:59:52 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20CORS=20=EC=84=A4=EC=A0=95=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 - localhost:5173 (개발 환경) 허용 - newstailor.site (배포 환경) 허용 --- .../infrastructure/config/CorsConfig.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/java/com/coanalysis/server/infrastructure/config/CorsConfig.java diff --git a/src/main/java/com/coanalysis/server/infrastructure/config/CorsConfig.java b/src/main/java/com/coanalysis/server/infrastructure/config/CorsConfig.java new file mode 100644 index 0000000..f48759a --- /dev/null +++ b/src/main/java/com/coanalysis/server/infrastructure/config/CorsConfig.java @@ -0,0 +1,18 @@ +package com.coanalysis.server.infrastructure.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://newstailor.site", "http://newstailor.site") + .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS") + .allowedHeaders("*") + .maxAge(3600); + } +}