feat(infra): HTTPS(TLS) 스캐폴딩 + 프록시 헤더 처리

- Spring prod: server.forward-headers-strategy=framework — nginx의 X-Forwarded-Proto를
  신뢰해 프록시 뒤에서도 request.isSecure()=true → Secure 쿠키·https 리다이렉트 정상화.
- frontend/nginx-tls.conf: 443 TLS 종료 + 80→443 리다이렉트(+ /api 프록시).
- infra/docker-compose.tls.yml: base와 함께 쓰는 HTTPS 오버레이(443 매핑·인증서 볼륨·
  ACS_PUBLIC_BASE_URL/ACS_COOKIE_SECURE). infra/certs/.gitignore로 인증서·키 커밋 제외.
- README: HTTPS 적용 절차(인증서 준비→.env→compose 오버레이) 갱신.

검증: forward-headers=framework + cookie.secure=true로 기동 후 X-Forwarded-Proto=https 유무 대조 —
헤더 있으면 XSRF-TOKEN·JSESSIONID 모두 Secure, 없으면 XSRF Secure 미부여(프록시 프로토콜 연동 확인).
자체서명 인증서 생성 확인. 전체 컨테이너 TLS e2e는 Docker 데몬 기동 시 별도 검증 필요.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
unknown
2026-07-03 16:12:14 +09:00
parent 17d6036bca
commit d8ba443b35
5 changed files with 93 additions and 6 deletions

View File

@@ -0,0 +1,21 @@
# HTTPS overlay. Use together with the base compose file:
# docker compose -f docker-compose.yml -f docker-compose.tls.yml up -d --build
#
# Requires a TLS certificate under ./certs/{fullchain.pem,privkey.pem}.
# For a quick internal/test cert (self-signed):
# openssl req -x509 -newkey rsa:2048 -nodes -days 825 \
# -keyout certs/privkey.pem -out certs/fullchain.pem -subj "/CN=<your-host>"
# For production, drop in the cert issued for your internal domain (corporate CA / public CA).
services:
web:
ports:
- "${WEB_TLS_PORT:-443}:443" # base file already maps WEB_PORT:80 (used for the redirect)
volumes:
- ./certs:/etc/nginx/certs:ro
- ../frontend/nginx-tls.conf:/etc/nginx/conf.d/default.conf:ro
app:
environment:
# The public link in the pass email/SMS + the secure-cookie switch.
ACS_PUBLIC_BASE_URL: ${ACS_PUBLIC_BASE_URL:-https://localhost}
ACS_COOKIE_SECURE: "true"