-
-
Notifications
You must be signed in to change notification settings - Fork 547
Description
Describe the bug
Continuation of #153 (comment).
Basically I am trying to set up swagger on my Spring Boot webflux app. It's deployed behind a reverse proxy. I already set up all necessary things like server.forward-headers-strategy=framework
and the x-forwarded-*
headers. It's working well on MVC app.
To Reproduce
Steps to reproduce the behavior:
Spring Boot 3.5.5
SpringDoc 2.8.9
- Set up Spring boot webflux app.
- Enable swagger UI from SpringDoc.
- Set up a reserve proxy that directs particular prefix to the app, eg http://localhost/gtw/swagger-ui/ --> http://localhost:8081/swagger-ui/
Actual behavior
-
When browsing swagger-ui, it loads swagger-config from the wrong path, eg http://localhost/v3/api-docs/swagger-config.
-
Interestingly, when I hit http://localhost/gtw/v3/api-docs/swagger-config manually, it contain the correct config with additional prefix, eg
{ "configUrl": "/gtw/v3/api-docs/swagger-config", "oauth2RedirectUrl": "http://localhost/gtw/swagger-ui/oauth2-redirect.html", "urls": [ { "url": "/gtw/v3/api-docs", "name": "Gateway API" }, { "url": "/gtw/v3/api-docs/main-service", "name": "Main Service" } ], "validatorUrl": "" }
-
When I remove
server.forward-headers-strategy=framework
, the config doesn't contain prefix, eg{ "configUrl": "/v3/api-docs/swagger-config", "oauth2RedirectUrl": "http://localhost/swagger-ui/oauth2-redirect.html", "urls": [ { "url": "/v3/api-docs", "name": "Gateway API" }, { "url": "/v3/api-docs/main-service", "name": "Main Service" } ], "validatorUrl": "" }
Expected behavior
- When browsing swagger-ui, it should load swagger-config from the correct path, eg http://localhost/gtw/v3/api-docs/swagger-config.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.