[fix] Swagger 요청이 https가 아닌 http로 전송되는 문제 - #63
Conversation
nginx가 넘기는 X-Forwarded-Proto/Host 를 Spring이 반영하도록 server.forward-headers-strategy=framework 를 추가한다. 이전엔 앱이 프록시 헤더를 무시해 springdoc이 http로 URL을 생성했다. 앱 포트는 127.0.0.1 바인딩이라 nginx만 접근하므로 헤더 신뢰가 안전하다.
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Coverage
|
kite707
left a comment
There was a problem hiding this comment.
Reverse proxy 환경에서 Forwarded 헤더 처리를 통해 Swagger URL이 HTTPS를 사용하도록 구성된 점 확인했습니다!
고생하셨습니다!
🔗 연관 이슈
📌 문제
Swagger UI에서 API 실행 시 요청이
https://가 아니라http://dev-api.gamss.kr/...로 전송됨(Request URL·curl 모두). HTTPS 엣지(nginx) 뒤인데 문서가 http로 URL을 생성.🔍 원인
X-Forwarded-Proto $scheme(443이면 https)를 앱에 전달 중.server.forward-headers-strategy미설정 →X-Forwarded-Proto를 무시 → springdoc이 요청을 http로 인식해 OpenAPIserversURL을http://로 생성.SwaggerConfig는 server URL을 명시하지 않아 요청 스킴을 그대로 사용.🔧 변경
application.yml에server.forward-headers-strategy: framework추가.ForwardedHeaderFilter가X-Forwarded-Proto/Host를 반영 → 문서·Try it out URL이 https로 생성.127.0.0.1:8080에만 바인딩돼 nginx만 접근 가능 → 헤더 신뢰 안전(외부 위조 주입 불가).nginx → app의proxy_pass http://...(같은 서버 평문 연결)는 변경하지 않음(정상 동작).✅ 검증 (런타임)
http://localhost:8080(정상)X-Forwarded-Proto: https(nginx처럼)https://dev-api.gamss.kr✅🌐 API · DB 영향