Kong rate limiting by exact path

Viewed 398

I have seen Kong rate-limiting plugin but I dont understand how can I configure it so I can ratelimit a specific URL (including path)

e.g. I want to ratelimit this:

GET /myapi/resource/id

Meaning accesses to "/api/user/123456" is allowed, lets say 1 per hour, and "/api/user/678941" is allowed same 1 per hour.

I guess this is limiting by path?

1 Answers

The rate limit plugin is the plugin that can be patched on global, route, service and consumer.

If you patched the plugin to all levels, The plugin, which was set as the minimal number of ratelimit, will be triggered. FYR: https://docs.konghq.com/hub/kong-inc/rate-limiting/
Plugin object:

{
    "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"]
}
Related