From 4f39e44ffe971c7711db6b2bb00162b230f8c830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=84=9D?= Date: Sat, 17 Aug 2024 13:07:50 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20localhost=EC=B6=94=EA=B0=80=ED=95=9C=20?= =?UTF-8?q?cors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../itpick/backend/config/WebConfig.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/store/itpick/backend/config/WebConfig.java b/src/main/java/store/itpick/backend/config/WebConfig.java index 6a863ef..aea343c 100644 --- a/src/main/java/store/itpick/backend/config/WebConfig.java +++ b/src/main/java/store/itpick/backend/config/WebConfig.java @@ -39,12 +39,20 @@ public void addArgumentResolvers(List resolvers) resolvers.add(getJwtHandlerArgumentResolver); } -// @Override -// public void addCorsMappings(CorsRegistry registry) { -// registry.addMapping("/**") -// .allowedOrigins("https://itpick.netlify.app") -// .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD") -// .allowedHeaders("Authorization", "Content-Type") -// .allowCredentials(true); -// } + + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("http://localhost:3000/", "http://localhost:5173/", "https://localhost:5173/", + "https://itpick.netlify.app") + .allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH") + .exposedHeaders("location", "Authorization") + .allowedHeaders("*") + .allowCredentials(true); + } + + + + } \ No newline at end of file