如何使用“ http:// localhost:port/swagger-ui/index.html`html`html”将kong声明性(YAML)路由路径路由路径。
启动:端口8099具有Swagger UI,它应该是Kong的路线,但在通往Kong的路线时,输出是空的。
也许这是空白页面的原因:它试图获取Swagger的HTML和CSS等。
- host: host.docker.internal
port: 8099
name: swagger-service
path: /swagger-ui/index.html
routes:
- name: swagger-service
paths:
- /swagger
strip_path: true
我尝试写 https://docs.konghq.com /枢纽/石材付款/kong-plugin-url-urerite/但仍然空的
- host: host.docker.internal
port: 8099
name: swagger-service
url: /swagger-ui/index.html
routes:
- name: swagger-service
plugins:
- name: kong-plugin-url-rewrite
config:
url: http://swagger
Implematation: port 8099 has swagger ui which suppose to be route in kong but the output is empty when its route to kong.
Maybe this is the reason for blank page: its trying to get the html and css and etc. of the swagger.
- host: host.docker.internal
port: 8099
name: swagger-service
path: /swagger-ui/index.html
routes:
- name: swagger-service
paths:
- /swagger
strip_path: true
I tried re write https://docs.konghq.com/hub/stone-payments/kong-plugin-url-rewrite/ but still empty
- host: host.docker.internal
port: 8099
name: swagger-service
url: /swagger-ui/index.html
routes:
- name: swagger-service
plugins:
- name: kong-plugin-url-rewrite
config:
url: http://swagger
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的问题是,当您尝试访问Swagger URL时,Swagger会尝试使用相同的基本URL(由Kong暴露的)从模式URL获取模式,因此您将拥有404没有作为路线添加。
解决此问题的一种方法是添加模式URL作为路线,以便可以从招摇路线上访问。
The issue here is that when you try to access your swagger url, the swagger will try to fetch the schema from the schema url using the same base url (the one exposed by kong), hence you will have a 404 since the schma url is not added as a route.
A way to fix this is to add the schema url also as a route so that it can be accessible from your swagger route.