Skip to content

[Chore/#164] common-api 설정 파일 추가와 Swagger dev 전용 노출 - #165

Merged
tnals0924 merged 1 commit into
mainfrom
chore/#164-common-api-config
Oct 22, 2026
Merged

tnals0924 merged 1 commit into
mainfrom
chore/#164-common-api-config

Conversation

@tnals0924

Copy link
Copy Markdown
Member

#️⃣연관된 이슈

🎯 해결하려는 문제가 무엇인가요?

  • common-api 모듈에 자체 설정 파일이 없어 Swagger(springdoc) on/off 설정이 bootstrap의 application-dev.yaml·application-prod.yaml에 직접 들어가 있었습니다.
  • 프로파일 없이 실행하면 springdoc 기본값(활성)이 적용되어 Swagger가 열려 있었습니다.
  • 리버스 프록시 뒤에서 X-Forwarded-* 헤더를 반영하지 않아 원래 요청의 스킴·호스트를 알 수 없었습니다.

❓ 왜 해결해야 하나요?

  • 컨벤션(config-and-auth.md 1절)상 설정 소유권은 해당 모듈에 있고, bootstrap에는 설정을 직접 쓰지 않습니다. 문서 조립 빈(OpenApiConfig)을 가진 common-api가 springdoc 설정도 소유하는 게 맞습니다.
  • 프로파일 지정을 빠뜨려도 API 문서가 노출되지 않도록 기본값을 닫아 둘 필요가 있습니다.

⭐ 어떻게 해결했나요?

  • api/common-api/src/main/resources/application-common-api.yml 추가
    • server.forward-headers-strategy: framework
    • springdoc swagger-ui·api-docs는 기본 false, spring.config.activate.on-profile: dev 문서에서만 true
  • bootstrap application.yaml의 spring.config.import에 classpath:application-common-api.yml 추가
  • bootstrap application-dev.yaml·application-prod.yaml에서 springdoc 블록 제거

🧩 이 PR의 한계 & 트레이드오프

  • prod는 기본값(비활성)에 맡기고 따로 명시하지 않았습니다.
  • 로컬에서 프로파일 없이 띄우면 Swagger가 닫혀 있으므로, 문서를 보려면 SPRING_PROFILES_ACTIVE=dev로 실행해야 합니다.

⛓️ 기존 기능에 미치는 영향

  • dev: 기존과 동일하게 Swagger가 열립니다.
  • prod: 기존과 동일하게 Swagger가 닫힙니다.
  • 프로파일 미지정: 열림 → 닫힘으로 바뀝니다.
  • forward-headers-strategy: framework로 ForwardedHeaderFilter가 등록되어, 프록시가 보낸 X-Forwarded-*/Forwarded 헤더가 요청 스킴·호스트·포트에 반영됩니다.

🔀 Edge Case & 실패 시나리오

  • bootstrap의 프로파일 파일(application-dev.yaml 등)에 springdoc 설정을 다시 넣으면 그쪽이 우선 적용되어 common-api 설정을 덮어씁니다.
  • framework 전략은 들어온 Forwarded 헤더를 그대로 신뢰하므로, 앱 앞단 프록시가 클라이언트가 보낸 X-Forwarded-* 헤더를 덮어쓰는 구성이어야 합니다.

📋 검토한 대안과 선택 이유

  • bootstrap 프로파일 파일에 그대로 두는 방식: 두 곳에 같은 설정이 생기고 bootstrap 쪽이 우선이라 common-api 설정이 무시되므로 이관했습니다.
  • 기본 활성 + prod만 비활성: 프로파일 지정 누락 시 문서가 노출될 수 있어 기본 비활성 + dev만 활성으로 정했습니다.

💬 리뷰 포인트

  • 앞단 프록시(배포 환경)가 X-Forwarded-* 헤더를 덮어쓰도록 설정돼 있는지 확인 부탁드립니다.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 8552e8a and 9d1d98a.

📒 Files selected for processing: 4
  • api/common-api/src/main/resources/application-common-api.yml
  • bootstrap/src/main/resources/application-dev.yaml
  • bootstrap/src/main/resources/application-prod.yaml
  • bootstrap/src/main/resources/application.yaml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tnals0924
tnals0924 merged commit c225dce into main Oct 22, 2026
2 checks passed
@tnals0924
tnals0924 deleted the chore/#164-common-api-config branch October 22, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

common-api 설정 파일 추가와 Swagger dev 전용 노출

2 participants