From 3fae92ad8f3d1a126aab62f804789de311738b33 Mon Sep 17 00:00:00 2001 From: jungeun Date: Tue, 6 Aug 2024 22:25:23 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EB=AA=A8=EB=93=A0=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EB=8B=A4=20=EB=B0=9B=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/likelion12/config/WebConfig.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main/java/com/example/likelion12/config/WebConfig.java diff --git a/src/main/java/com/example/likelion12/config/WebConfig.java b/src/main/java/com/example/likelion12/config/WebConfig.java new file mode 100644 index 0000000..1d6ffd4 --- /dev/null +++ b/src/main/java/com/example/likelion12/config/WebConfig.java @@ -0,0 +1,20 @@ +package com.example.likelion12.config; + +import org.springframework.context.annotation.Bean; +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 WebConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") // 모든 출처 허용 + .allowedMethods("GET", "POST", "PUT", "PATCH", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(false) + .maxAge(3600); + } +}