如何在Kong Api-Gateway返回静态响应
我在其db-never模式下使用了kong api-gateway
结果,
_format_version: "2.1"
_transform: true
services:
- name: service1
url: http://service1:port/sample-path
routes:
- name: service1
methods:
- GET
paths:
- /service1/sample-path
strip_path: true
,我有一个kong.yaml文件,如下所示:如您所见,API-GATEWAY DISPATCHES来自/service>/service>/service1/sample-path
http:// service1:port/sample-path 的API-GATWAY的端点>
> /代码> API-GATEWAWE的端点,它加载YAML或JSON文件并将其作为响应返回。
在行动中,我正在寻找一种返回静态响应而不是派遣请求的方法?
知道该怎么做吗?
伪代码
_format_version: "2.1"
_transform: true
services:
- name: service1
url: http://service1:port/sample-path
routes:
- name: service1
methods:
- GET
paths:
- /service1/sample-path
strip_path: true
- name: oas
url: STATIC YAML OR JSON FILE
routes:
- name: oas
methods:
- GET
paths:
- /oas
strip_path: true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用插件
You can handle that with the plugin https://github.com/IntelliGrape/kong-plugin-static-response