Dynamically set the RouteID to a Service based on a Header?

Hi ,

I’m looking into setting up rate limiting based on Routes; All Routes will be to the same Service.

For example:

  • Route 1 will have Rate Limit plugin of 10 tps
  • Route 2 will have Rate Limit plugin of 20 tps
  • Route 3 will have Rate Limit plugin of 30 tps

Imagine -based on the value of an incoming HTTP header (e.g. Gold, Silver, Bronze), we set the routeId of the request to one of the above, so that the request is rate limited appropriately. Think of it as Rate limit Tiering. I’m avoid Consumers for any rate limiting due to overhead.

Looking at Enterprise Plugins, and the custom Plugin documentation, Im unable to see anything that allows Kong to set the request to a particular route on the fly. In the Kong PDK your can get RouteIDs but not set them it seems. https://docs.konghq.com/enterprise/2.1.x/pdk/kong.router/

Any help appreciated