Hello Champs,
We are running kong 2.1.4 in gateway mode on k8s.
Im looking to enable different rate limiting tiers for customers on the same routes\services.
Use Case: Client A with header ‘x-api-key: 123’ gets higher rate limit, Client B with header ‘x-api-key 321’ is getting the default rate limit setting for the route\service.
I was able to
- Play with the rate limit plugin and configure rate limiting based on configurable header value
if not identifier and conf.limit_by_api_key_header == true then api_key_value= kong.request.get_header('x-api-key') if api_key_value == conf.api_key then identifier = api_key_value kong.log.err("value is: ", api_key_value) kong.log.err("identifier is: ", identifier) end end
- Use consumers + key-auth plugin to give each consumer its own rate limit setting
But when i have a request with ‘x-api-key’ that is not defined in one of the consumers i.e any other client that did not pay for extra rate limit, Im getting a 401 Invalid authentication credentials
and the requests without consumer still land on the special rate limit route
Is there any config i can do to achieve this ?