fix: swagger-config 프록시 누락으로 Swagger UI가 petstore로 폴백되는 문제 수정 - #247
Merged
Conversation
/v3/api-docs를 정확히 일치(location =)로 매칭해 swagger-ui가 실제 스펙 위치를 알아내려고 요청하는 /v3/api-docs/swagger-config 가 SPA fallback(index.html)으로 떨어졌다. prefix 매칭으로 바꿔 하위 경로도 backend로 프록시되게 한다. Closes #246
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Reviewed by step-3.7-flash · Input: 42K · Output: 6.9K · Cached: 267.3K |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 내용
nginx.conf의location = /v3/api-docs(정확히 일치)를location /v3/api-docs(prefix)로 변경배경
#245 배포 후 실제로 확인해보니 Swagger UI가
https://petstore.swagger.io/v2/swagger.json데모 스펙으로 떴다. 원인은 swagger-ui JS가 페이지 로드시 실제 스펙 위치를 알아내려고GET /v3/api-docs/swagger-config를 추가로 호출하는데, 기존 nginx location이/v3/api-docs를 정확히 일치로만 매칭해서 이 하위 경로 요청이 SPA fallback(index.html)으로 떨어졌기 때문이다. swagger-ui는 이 요청이 JSON이 아니면 조용히 기본 데모 설정으로 폴백한다.검증
nginx -t문법 검증 통과docker compose up -d --build backend frontend후frontend컨테이너 내부(127.0.0.1:80)에서 직접 확인GET /v3/api-docs→ 200GET /v3/api-docs/swagger-config→ 200, 응답 본문"url":"/v3/api-docs"확인 (이전에는 SPA index.html이 떨어졌음)GET /swagger-ui/index.html→ 200GET /→ 200, SPA 라우팅 정상 유지연결 이슈
Closes #246