Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Issue on swagger UI on Spring Webflux behind reverse proxy #3081

Closed
@andreasarf

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

  1. Set up Spring boot webflux app.
  2. Enable swagger UI from SpringDoc.
  3. 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

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /