【发布时间】:2021-09-08 00:57:54
【问题描述】:
我见过 Kong 限速插件,但我不明白如何配置它,以便我可以对特定 URL(包括路径)进行限速
例如我想对此进行速率限制:
GET /myapi/resource/id
意味着对“/api/user/123456”的访问是允许的,假设每小时 1 次,而“/api/user/678941”也允许每小时 1 次。
我猜这是路径限制?
【问题讨论】:
我见过 Kong 限速插件,但我不明白如何配置它,以便我可以对特定 URL(包括路径)进行限速
例如我想对此进行速率限制:
GET /myapi/resource/id
意味着对“/api/user/123456”的访问是允许的,假设每小时 1 次,而“/api/user/678941”也允许每小时 1 次。
我猜这是路径限制?
【问题讨论】:
限速插件是可以在全局、路由、服务和消费者上打补丁的插件。
如果您将插件修补到所有级别,将触发设置为最小速率限制的插件。
财政年度:https://docs.konghq.com/hub/kong-inc/rate-limiting/
插件对象:
{
"id": "ce44eef5-41ed-47f6-baab-f725cecf98c7",
"name": "rate-limiting",
"created_at": 1422386534,
"route": #if you want to patch on route level set here,
"service": #if you want to patch on servicelevel set here,
"consumer": #if you want to patch on consumer level set here,
"config": {"minute":20, "hour":500},
"protocols": ["http", "https"],
"enabled": true,
"tags": ["user-level", "low-priority"]
}
【讨论】: