首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Swagger UI重定向到/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config

Swagger UI重定向到/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config
EN

Stack Overflow用户
提问于 2020-05-27 21:25:31
回答 4查看 12.1K关注 0票数 8

我使用的是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。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 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.

票数 5
EN

Stack Overflow用户

发布于 2020-11-25 11:52:03

我也遇到了这个问题,因为我们的应用程序在网关/负载均衡器后面,在Docker上。我的目标是真正访问Swagger UI,而我的变通方法是直接访问/swagger-ui/index.html。它加载"Swagger Petstore“。在"Explore“字段中,输入/v3/api-docs以加载应用程序的API。

票数 1
EN

Stack Overflow用户

发布于 2022-01-19 12:11:27

这不是关于重定向的问题,因为它只对http://localhost:8080/swagger-ui/index.html开放。但一些答案是关于禁用petshop和configUrl的。对于自动配置的springdoc,提供configUrl不再起作用。覆盖url、配置url (如果需要)和默认url适用于以下application.yml:

代码语言:javascript
复制
springdoc:
  swagger-ui:
    url: "/v3/api-docs"
    disable-swagger-default-url: true

或者你可以使用主题插件:

代码语言:javascript
复制
springdoc:
  swagger-ui:
    disable-swagger-default-url: true
    urls:
      - url: "/v3/api-docs"
        name: "myService"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62044228

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档