Skip to content

/swagger-ui/index.html won't render for secondary application on same path #3129

@DavidClifford-Pro

Description

@DavidClifford-Pro

Describe the bug
I see an issue where when I try and open Swagger that has the same url path as another application, it won't open for whatever application ran second(I'm only running 1 application at a time)

I'm trying to transition from SpringFox to SpringDoc (all this is done and the swagger pages function as intended). Just rendering for each subsequent applications will not work.

I'm using:

  1. org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.13
  2. Latest Spring Boot 3.5.7
  3. Latest Spring Framework 6.2.12
  4. Using Java 21

To Reproduce
Create 2 applications that both use swagger and setup with same configuration. Perhaps utilize different controllers/endpoints though.

  1. Run 1 application and access the swagger page (/swagger-ui/index.html)
  2. Note that application 1 will render properly
  3. Turn off the first application
  4. Run the second application and access the swagger page (/swagger-ui/index.html)
  5. Note that application 2 WILL NOT OPEN SWAGGER
  6. Try application 2 within private browser will work though
  7. Clearing cookies will allow either application to render

My application.yml config:

springdoc:
  swagger-ui:
    doc-expansion: none
    defaultModelExpandDepth: 0
    syntax-highlight:
      activated: false

If a video is necessary, I could do this.

Expected behavior
It's expected that running multiple applications (not at the same time) will still allow connecting to the swagger page. I'm providing an example with 2 applications, but the system I work on has close to 100 swagger pages. Since all of these will be deployed on separate IP addresses, it won't be a concern there for testing in lower-life cycles. But when it comes to testing stuff locally, it'll become a nightmare.

Screenshots
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions