{"id":22220964,"url":"https://github.com/nokia/consumer-rate-limiting","last_synced_at":"2025-07-27T16:30:54.627Z","repository":{"id":47058624,"uuid":"104092326","full_name":"nokia/consumer-rate-limiting","owner":"nokia","description":"A consumer rate limiting plugin for Kong (https://getkong.org/)","archived":false,"fork":false,"pushed_at":"2021-09-15T11:25:47.000Z","size":17,"stargazers_count":32,"open_issues_count":4,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T13:07:11.933Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nokia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-19T15:21:41.000Z","updated_at":"2024-01-19T19:02:07.000Z","dependencies_parsed_at":"2022-09-05T11:51:15.660Z","dependency_job_id":null,"html_url":"https://github.com/nokia/consumer-rate-limiting","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2Fconsumer-rate-limiting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2Fconsumer-rate-limiting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2Fconsumer-rate-limiting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2Fconsumer-rate-limiting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nokia","download_url":"https://codeload.github.com/nokia/consumer-rate-limiting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817164,"owners_count":17824199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T23:11:13.053Z","updated_at":"2024-12-02T23:11:13.597Z","avatar_url":"https://github.com/nokia.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Consumer Rate Limiting plugin for Kong\n\n[![Build Status](https://travis-ci.org/nokia/consumer-rate-limiting.svg?branch=master)](https://travis-ci.org/nokia/consumer-rate-limiting)\n\n## Description\n\n\u003cb\u003eConsumer Rate Limiting\u003c/b\u003e is a [Kong](https://getkong.org/) plugin, which allows to define more configurable request limiting, than the built-in Rate Limiting plugin. Consumer Rate Limiting allows to dynamically define different limits for every consumer and API via Kong Admin API. Limits are reset every month.\n\n| Call count   | Consumer 1 | Consumer 2 | Consumer 3 |\n|--------------|------------|------------|------------|\n| API 1        | 100        | 50         | 1000       |\n| API 2        | 150        | 40         | 500        |\n| API 3        | 50         | 40         | 500        |\n\nThe above table shows an example configuration you can achieve using this plugin.\n\n### Usage\n\nThe plugin can be installed using LuaRocks:\n\n```\nluarocks install kong-consumer-rate-limiting\n```\n\nBefore starting Kong you need to set the environment variable `KONG_CUSTOM_PLUGINS`:\n```\nexport KONG_CUSTOM_PLUGINS=consumer-rate-limiting\n```\n\nTo enable the plugin in Kong:\n```\n$ curl -X POST http://kong:8001/plugins \\\n    --data \"name=consumer-rate-limiting\"\n```\n\n### Request processing\nThis plugin integrates with generic Kong authentication plugins, so you can use any available authorization plugin to identify consumers.\n\nIf the plugin gets an authenticated call it looks, if the consumer has a limit defined for the API his calling. If not it look at the default limits. If no limits are defined the call is passed through the plugin.\n\nIn case the consumer already exceeded the call count, the call is not passed to the destination API and a HTTP response with code 429 is send back.\n\n## Admin API routes\n\n### POST /consumer-rate-limiting/consumers\nSet limits for consumers.\n\n```\nPOST /consumer-rate-limiting/consumers\n{\n\t\"consumer_id\": \"consumer_1\"\n    \"quotas\": [\n    \t{\n        \t\"api_id\": \"api_1\",\n            \"quota\": 100\n        },\n        {\n        \t\"api_id\": \"api_2\",\n            \"quota\": 150\n        },\n        {\n        \t\"api_id\": \"api_3\",\n            \"quota\": 50\n        }\n    ]\n}\n```\n\n### GET /consumer-rate-limiting/consumer/:id\nGet current consumer limits and call counts\n\n### POST /consumer-rate-limiting/default\nSets default limits for undefined consumers\n\n\n## License\n\nThis project is licensed under the BSD-3-Clause license - see the [LICENSE](https://github.com/nokia/consumer-rate-limiting/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnokia%2Fconsumer-rate-limiting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnokia%2Fconsumer-rate-limiting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnokia%2Fconsumer-rate-limiting/lists"}