【问题标题】:'unable to infer base url' Swagger-ui : Kubernetes using Traefik Ingress Controller'无法推断基本 url' Swagger-ui:Kubernetes 使用 Traefik 入口控制器
【发布时间】:2020-01-25 18:12:08
【问题描述】:

当我在 kubernetes 环境中部署后尝试访问我的 swagger url 时遇到此错误消息。

当我在 localhost 上运行我的 Spring Boot 应用程序时,我可以毫无错误地看到招摇。

我使用 Traefik 作为我的入口控制器。

【问题讨论】:

标签: spring-boot kubernetes traefik-ingress


【解决方案1】:

Spring boot 应用,必须在 application.yml/perporties 文件中添加 Server 上下文路径。

例子:

服务器: 小服务程序: 上下文路径:/

添加 context-path 后可以看到 swagger-ui 网址:localhost:8080/api/swagger-ui.html

注意: 根路径名称为“api”,您已在 Ingress.yml 文件中配置。

规格: 规则: - 主持人: 网址: 路径: - 路径:/api 后端: 服务名称:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-06
    • 1970-01-01
    • 2019-12-21
    • 2018-08-15
    • 1970-01-01
    • 2019-10-10
    • 1970-01-01
    • 2021-10-24
    相关资源
    最近更新 更多