From 7ed2465d579152d19312e9751c277bed479633b3 Mon Sep 17 00:00:00 2001 From: jhbkjh Date: Thu, 30 Oct 2025 10:37:36 +0900 Subject: [PATCH] =?UTF-8?q?participation-service=20CORS=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SecurityConfig.java @Value 어노테이션 문법 오류 수정 - application.yml CORS allowed-origins에 localhost:3000 추가 - Frontend UI (localhost:3000)에서 API 호출 시 CORS 에러 해결 --- .../participation/infrastructure/config/SecurityConfig.java | 2 +- participation-service/src/main/resources/application.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java index ff51aed..f11e549 100644 --- a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java +++ b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java @@ -24,7 +24,7 @@ import java.util.Arrays; @EnableWebSecurity public class SecurityConfig { - @Value("${cors.allowed-origins:*") + @Value("${cors.allowed-origins:*}") private String allowedOrigins; @Bean diff --git a/participation-service/src/main/resources/application.yml b/participation-service/src/main/resources/application.yml index 2f35890..7ad3c96 100644 --- a/participation-service/src/main/resources/application.yml +++ b/participation-service/src/main/resources/application.yml @@ -56,7 +56,7 @@ jwt: # CORS 설정 cors: - allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io} + allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io} allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS,PATCH} allowed-headers: ${CORS_ALLOWED_HEADERS:*} allow-credentials: ${CORS_ALLOW_CREDENTIALS:true}