티스토리 뷰

728x90
반응형

What?

springdoc-openapi Swagger를 접속할 때 Fail to load remote configuration 에러 문구와 함께 swagger 접속 불가

Why?

**/v3/api-docs/swagger-config 를 불러오지 못하는 문제 (404 Error)

로컬이나 서버 도메인으로 접속할 때는 정상 호출되지만 API Gateway를 통해 접속할 때 API path prefix가 변경될 때 이슈

 

비정상 호출 : http://apigw.com/v3/api-docs/swagger-config

정상 호출 : http://apigw.com/aa/v3/api-docs/swagger-config

How?

아래 옵션을 .yml 에 추가해주면 해결된다.

server:
  forward-headers-strategy: FRAMEWORK

배포 이후에도 계속 swagger-config를 불러오지 못하는데 

swagger-config는 spec-actions.js에서 호출되는데 .js 파일이 브라우저에 캐싱되었던 문제.

브라우저 캐시 삭제 후 정상 호출된다.

 

https://godekdls.github.io/Spring%20Boot/howto.embedded-web-servers/#12312-running-behind-a-front-end-proxy-server

https://springdoc.org/v1/index.html#how-can-i-deploy-springdoc-openapi-ui-behind-a-reverse-proxy

https://github.com/springdoc/springdoc-openapi/issues/1741

https://github.com/springdoc/springdoc-openapi/issues/1712

https://github.com/springdoc/springdoc-openapi/issues/1748

728x90
반응형
반응형
300x250