From 59f5eb3d43f88590e1260e3991dc6eb183740913 Mon Sep 17 00:00:00 2001 From: gkim Date: Sun, 24 Dec 2023 01:24:51 +0900 Subject: [PATCH] :wrench: fix: Add cors allowed origins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - allowed origins 추가 Related: #50 --- src/main/java/com/ceos/vote/common/config/CorsConfig.java | 7 ++++--- src/main/resources/application.yml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ceos/vote/common/config/CorsConfig.java b/src/main/java/com/ceos/vote/common/config/CorsConfig.java index 435739d..c24d441 100644 --- a/src/main/java/com/ceos/vote/common/config/CorsConfig.java +++ b/src/main/java/com/ceos/vote/common/config/CorsConfig.java @@ -11,17 +11,18 @@ public class CorsConfig { @Value("${domain}") - private String domain; + private String clientUrl; @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); - config.addAllowedOrigin(domain); + config.addAllowedOrigin("http://localhost:3000"); + config.addAllowedOrigin(clientUrl); config.addAllowedHeader("*"); config.addAllowedMethod("*"); - source.registerCorsConfiguration("/**",config); + source.registerCorsConfiguration("/**", config); return new CorsFilter(source); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3725fc4..cfb036d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -44,4 +44,4 @@ springdoc: swagger-ui: path: /swagger-vote.html -domain: ENC(wtMoW4E5IOZgq215uWHzGsBlrqecbyNr9lsrql5da0LFtz4cywsN8Fap3bhNqVYQ0RuvblLIewQZo+u8pBCaFA==) \ No newline at end of file +clientUrl: ENC(xZJ/NyHwyN5VEY3W6Btq++gSySY0VzGxn9iJuP25Wj3vmwGsulhgRQ==) \ No newline at end of file