From 4225a42d29ad340a95771ab86858c131703557fc Mon Sep 17 00:00:00 2001 From: sjungwon03 Date: Fri, 24 Jul 2026 16:15:41 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20nginx=EC=97=90=20Swagger=20UI/OpenAPI?= =?UTF-8?q?=20=EB=AC=B8=EC=84=9C=20=ED=94=84=EB=A1=9D=EC=8B=9C=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /api 프리픽스 밖에 있는 백엔드 springdoc 경로(/swagger-ui/**, /swagger-ui.html, /v3/api-docs)가 SPA fallback(index.html)으로 떨어져 배포 도메인에서 열리지 않던 문제를 backend로 직접 프록시하여 해결한다. Closes #244 --- nginx.conf | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/nginx.conf b/nginx.conf index 64fa8aa..c4dc678 100644 --- a/nginx.conf +++ b/nginx.conf @@ -28,6 +28,31 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } + # springdoc-openapi(Swagger) 문서. backend가 직접 서빙하므로 /api 프리픽스 없이 그대로 넘긴다. + location /swagger-ui/ { + proxy_pass http://backend:8080/swagger-ui/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location = /swagger-ui.html { + proxy_pass http://backend:8080/swagger-ui.html; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location = /v3/api-docs { + proxy_pass http://backend:8080/v3/api-docs; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + location / { try_files $uri $uri/ /index.html; }