From f55d9988033ec76a9df3fc6c67fbbeea13dd0bde Mon Sep 17 00:00:00 2001 From: ByungCheol Date: Sun, 31 May 2026 20:49:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20HTTPS=20=ED=94=84=EB=A1=9D=EC=8B=9C=20?= =?UTF-8?q?=EB=92=A4=20CORS=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0=20(f?= =?UTF-8?q?orward-headers=20+=20=EC=9A=B4=EC=98=81=20=EC=98=A4=EB=A6=AC?= =?UTF-8?q?=EC=A7=84=20=ED=97=88=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- src/main/java/com/sb/web/common/config/CorsConfig.java | 10 ++++++---- src/main/resources/application.yml | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sb/web/common/config/CorsConfig.java b/src/main/java/com/sb/web/common/config/CorsConfig.java index 78db081..4f69448 100644 --- a/src/main/java/com/sb/web/common/config/CorsConfig.java +++ b/src/main/java/com/sb/web/common/config/CorsConfig.java @@ -18,10 +18,12 @@ public class CorsConfig implements WebMvcConfigurer { public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/api/**") .allowedOrigins( - "http://localhost:5173", // Vue 개발 서버 - "capacitor://localhost", // Capacitor (iOS scheme) - "https://localhost", // Capacitor Android (기본 https scheme) - "http://localhost" // Capacitor Android (http scheme) + "http://localhost:5173", // Vue 개발 서버 + "capacitor://localhost", // Capacitor (iOS scheme) + "https://localhost", // Capacitor Android (기본 https scheme) + "http://localhost", // Capacitor Android (http scheme) + "https://app.sblog.kr", // 운영 웹 (안전망) + "http://app.sblog.kr" ) .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS") .allowedHeaders("*") diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a9ed0c8..b8b10e3 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,6 +2,8 @@ server: port: 8080 servlet: context-path: / + # Nginx(HTTPS) 리버스 프록시 뒤 — X-Forwarded-* 를 신뢰해 원래 스킴/호스트 인식 (CORS·리다이렉트 정확) + forward-headers-strategy: framework spring: # 로컬 개발 시 .env(properties 형식, git 미추적)에서 환경변수 로드. 없으면 OS/컨테이너 환경변수 사용.