spring-boot - api网关后面的Springdoc configUrl
问题描述
我使用 spring 云网关路由/myapi 启动并运行 springdoc swagger ui。所以当我点击网址时
https://myhost.com/myapi
它把我重定向到一个网址
https://myhost.com/myapi/webjars/swagger-ui/index.html?configUrl=/swagger-config.json
我的 application.yml 文件中有以下代码
springdoc:
swagger-ui:
path: /
configUrl: /swagger-config.json
我也设置了以下属性
server.forward-headers-strategy: framework
我的问题是我还需要做什么才能让重定向的 url 在配置 URL 中也包含 API 网关路由?基本上我希望重定向的网址是
https://myhost.com/myapi/webjars/swagger-ui/index.html?configUrl=/myapi/swagger-config.json
而不是
https://myhost.com/myapi/webjars/swagger-ui/index.html?configUrl=/swagger-config.json
解决方案
我在 github ( https://github.com/springdoc/springdoc-openapi/issues/1144 ) 上收到了该项目的一位贡献者的回复。如果我们使用默认的 springdoc.swagger-ui.configUrl 而不是明确指定它,这一切都很好。
推荐阅读
- ms-access - Microsoft Access Sum IIf 表达式
- sql - SQLite:从一列中选择多个计数
- angular - 如何在订阅激活后将操作项添加到订阅中?
- c# - 开/关本金多层次
- sql - Oracle SQL 中的模式匹配
- freemarker - 如何在 FreeMarker 模板中调试低效的 JCR 查询?
- node.js - MSSQL - 节点 - 内存泄漏
- python - 如何在类主体中模拟外部模块调用和测试代码
- objective-c - 在objective-c中调用self.class上的方法实际上不是类方法时如何获得编译时失败?
- python - 加载文本文件时如何保持好行和坏行?