【问题标题】:springdoc-openapi-ui How do I set the request to HTTPSspringdoc-openapi-ui 如何将请求设置为 HTTPS
【发布时间】:2022-04-04 15:41:41
【问题描述】:

我发布的时候会使用HTTPS请求而不是HTTP,但是swagger原来的URL还是HTTP,不知道怎么设置,而且原来springdoc-openapi-ui配置中也没有servers的文档

https://springdoc.org/index.html#properties

【问题讨论】:

    标签: springdoc springdoc-openui


    【解决方案1】:

    你可以试试这个:

    ...
    import io.swagger.v3.oas.annotations.OpenAPIDefinition;
    import io.swagger.v3.oas.annotations.servers.Server;
    ...
    @OpenAPIDefinition(servers = {@Server(url = "/", description = "Default Server URL")})
    
    @SpringBootApplication
    public class MyApplication {
    ...
    }
    

    更多信息在这里https://github.com/springdoc/springdoc-openapi/issues/726

    【讨论】:

    • 唯一对我有用的方法。只需设置“url = /”即可使 REST 调用相对于您所在的位置(无需重写主机或任何东西)。
    【解决方案2】:

    对于谁正在使用 CXF。我在这里提交了一个问题:

    https://issues.apache.org/jira/browse/CXF-8685

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-07
      • 2021-11-09
      • 1970-01-01
      • 2020-09-09
      • 2021-03-29
      • 1970-01-01
      • 2022-12-06
      相关资源
      最近更新 更多