Description
Describe the bug
We are running a spring-boot application behind a load balancer that terminates HTTPS. When accessing https://my-application.url/swagger-ui.html it redirects to http://my-application.url/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config. This is caused by the fact that SwaggerWelcomeWebMvc#redirectToUi returns a String with redirect:
prefix. This causes the tomcat to return an absolute URL, using HTTP as protocol instead of HTTPS, in the HTTP location header.
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using: 2.4.1
- What modules and versions of springdoc-openapi are you using:
springdoc-openapi-ui
,springdoc-openapi-data-rest
Expected behavior
The redirect respects the used protocol, in this case HTTPS. I guess a relative redirect could solve this problem.
Additional context
As a workaround you can either access https://my-application.url/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config directly or set server.tomcat.use-relative-redirects=true
in your application.properties