From 19d37694ec49244d155862ff8f8679a246b19ac5 Mon Sep 17 00:00:00 2001 From: junho Date: Mon, 23 Oct 2023 22:39:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20cors=20=EC=84=A4=EC=A0=95,=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=8B=9C=EA=B0=84=2030=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/spaceclub/global/config/WebConfig.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/java/com/spaceclub/global/config/WebConfig.java diff --git a/src/main/java/com/spaceclub/global/config/WebConfig.java b/src/main/java/com/spaceclub/global/config/WebConfig.java new file mode 100644 index 00000000..976fe79f --- /dev/null +++ b/src/main/java/com/spaceclub/global/config/WebConfig.java @@ -0,0 +1,18 @@ +package com.spaceclub.global.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 WebConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedMethods("*") + .allowCredentials(true) + .maxAge(1800); // 1800초, 30분으로 설정 + } + +}