I have a very basic Spring Boot 3 service with OpenAPI documentation using Spring Initializr.
plugins {
java
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.4.0")
...
}
java.sourceCompatibility = JavaVersion.VERSION_21
These two URLs work:
- http://localhost:8080/v3/api-docs (shows JSON)
- http://localhost:8080/swagger-ui.html (redirects to http://localhost:8080/webjars/swagger-ui/index.html)
However, because my app is behind a reverse proxy, I want to customize these URLs. Setting the following in my application.yaml file does not work:
springdoc:
api-docs:
path: '/api/admin/v3/api-docs'
swagger-ui:
config-url: '/api/admin/v3/api-docs/swagger-config'
path: '/api/admin/swagger-ui.html'
These pages load but navigating to the swagger-ui page shows me the Petstore demo app instead of my own app's documentation. Why?