0

I want to apply rate limiting by header.

if X-yunus-api-key == fasdasd231jnde32e32e , apply rate limit.

Does Kong has this feature ?

--header 'Cache-Control: no-cache' \
--header 'X-yunus-api-key: fasdasd231jnde32e32e' \
--header 'Content-Type: application/json' \
--data-raw '{ }'
user10651098
  • 75
  • 1
  • 7

1 Answers1

1

I want to apply rate limiting by header.
if X-yunus-api-key == fasdasd231jnde32e32e , apply rate limit.

Setting config.limit_by to header and specify config.header_name to X-yunus-api-key in rate-limiting plugin should be enough for your use case.

If you also want to validate the consumer. Using the key-auth plugin and setting credentials for consumers is another valid option

Ponsakorn30214
  • 267
  • 4
  • 11
  • Actually want to apply rate limit by header value. This is for rate limit by header. in this case, if header change, rate limit will be disable. For example; X-yunus-api-key has 3 value, first: fasdasd231jnde32e32e, second : 123uıqwd1, third: 214eu23ınufr. I want to apply rate limit if X-yunus-api-key = fasdasd231jnde32e32e. I dont want to apply rate limit second and third value. @Ponsakorn30214 – user10651098 Jul 28 '22 at 13:40
  • 1
    If you want to validate the header value, the second option I provided will be suitable for you 1. Set `config.key_names` in key-auth plugin to validate the header key. 2. Create a consumer 3. Create key credential for said consumer example can be seen in key-auth plugin link I provided – Ponsakorn30214 Jul 28 '22 at 14:56