From 24656354ce7a15d2b833aa348a16ae622c0a28cb Mon Sep 17 00:00:00 2001 From: nahjjun Date: Sun, 4 Jan 2026 16:58:24 +0900 Subject: [PATCH] =?UTF-8?q?:wrench:=20Setting:=20Cors=20Config=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95=20-=20EC2=20public=20ip:8080=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/umc_springboot/global/config/CorsConfig.java | 6 +++++- .../umc_springboot/global/config/SecurityConfig.java | 2 +- src/main/resources/application-dev.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/umc_springboot/global/config/CorsConfig.java b/src/main/java/com/example/umc_springboot/global/config/CorsConfig.java index 2ff58ec..0e9a0bb 100644 --- a/src/main/java/com/example/umc_springboot/global/config/CorsConfig.java +++ b/src/main/java/com/example/umc_springboot/global/config/CorsConfig.java @@ -20,7 +20,11 @@ public CorsConfigurationSource corsConfigurationSource() { config.setAllowCredentials(true); // 허용할 origin(출처, 도메인) - config.setAllowedOrigins(List.of("http://localhost:5173")); + config.setAllowedOrigins(List.of( + "http://localhost:5173", + "http://43.202.8.13:8080" + + )); // 예: React/Vite 개발 서버에서 오는 요청 허용 // 허용할 HTTP Method diff --git a/src/main/java/com/example/umc_springboot/global/config/SecurityConfig.java b/src/main/java/com/example/umc_springboot/global/config/SecurityConfig.java index b9cd3c3..5e10391 100644 --- a/src/main/java/com/example/umc_springboot/global/config/SecurityConfig.java +++ b/src/main/java/com/example/umc_springboot/global/config/SecurityConfig.java @@ -123,7 +123,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { response.setCharacterEncoding("UTF-8"); // 3. 반환할 데이터 생성 - GlobalResponse globalResponse = GlobalResponse.success("403", "로그인 실패"); + GlobalResponse globalResponse = GlobalResponse.error("403", "로그인 실패"); // 4. objectMapper로 자바 객체 JSON으로 직렬화 objectMapper.writeValue(response.getWriter(), globalResponse); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 491f136..6255c31 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -12,7 +12,7 @@ spring: database-platform: org.hibernate.dialect.MySQLDialect # Hibernate에서 사용할 MySQL 방언(dialect) 설정 show-sql: true # 실행된 SQL 쿼리를 콘솔에 출력할지 여부 설정 hibernate: - ddl-auto: create # 애플리케이션 실행 시 데이터베이스 스키마의 상태를 설정, -> 첫 배포할 때는 create로 설정 + ddl-auto: update # 애플리케이션 실행 시 데이터베이스 스키마의 상태를 설정, -> 첫 배포할 때는 create로 설정 properties: hibernate: format_sql: true # 출력되는 SQL 쿼리를 보기 좋게 포맷팅