I am using springdoc-openapi-ui
, when I hit http://localhost:8080/swagger-ui.html URL it is always redirecting to http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config. Is there any way to stop this redirect and load swagger on http://localhost:8080/swagger-ui.html instead.
By default, Swagger UI is accessible at /q/swagger-ui . The value / is not allowed as it blocks the application from serving anything else. A value prefixed with '/' makes it absolute and not relative. Once your application is started, you can go to http://localhost:8080/q/swagger-ui and play with your API.
The static yaml file is fetched from Swagger Editor, put it under the resources directory. info: description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).
Add and configure Swagger middleware The generated document describing the endpoints appears as shown in OpenAPI specification (openapi. json). The Swagger UI can be found at https://localhost:<port>/swagger .
I have asked the same question on Github
site regarding the same. Link is provided below
https://github.com/springdoc/springdoc-openapi/issues/742#issue-642810354
Got the reply from one of the contributor
springdoc-openapi uses an internal redirect to resolve the necessary swagger resources. This the way the library is built.
You use you own version of swagger-ui, so you can add your custom Logic, without having to rely on springdoc-openapi-ui.
I also encountered this issue because our app is behind a gateway/load balancer and on Docker. My goal is to really just access the Swagger UI and my workaround is to access /swagger-ui/index.html
directly. It loads the "Swagger Petstore". In the "Explore" field, I type /v3/api-docs
to load my application's APIs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With