我使用的是springdoc-openapi-ui,当我点击http://localhost:8080/swagger-ui.html地址时,它总是重定向到http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config。有没有办法停止这种重定向,转而在http://localhost:8080/swagger-ui.html上加载swagger。
发布于 2020-06-22 20:16:14
我在Github网站上也问过同样的问题。下面提供了链接
https://github.com/springdoc/springdoc-openapi/issues/742#issue-642810354
得到了其中一位贡献者的回复
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.
发布于 2020-11-25 11:52:03
我也遇到了这个问题,因为我们的应用程序在网关/负载均衡器后面,在Docker上。我的目标是真正访问Swagger UI,而我的变通方法是直接访问/swagger-ui/index.html。它加载"Swagger Petstore“。在"Explore“字段中,输入/v3/api-docs以加载应用程序的API。
发布于 2022-01-19 12:11:27
这不是关于重定向的问题,因为它只对http://localhost:8080/swagger-ui/index.html开放。但一些答案是关于禁用petshop和configUrl的。对于自动配置的springdoc,提供configUrl不再起作用。覆盖url、配置url (如果需要)和默认url适用于以下application.yml:
springdoc:
swagger-ui:
url: "/v3/api-docs"
disable-swagger-default-url: true或者你可以使用主题插件:
springdoc:
swagger-ui:
disable-swagger-default-url: true
urls:
- url: "/v3/api-docs"
name: "myService"https://stackoverflow.com/questions/62044228
复制相似问题