Hi, i’m using tyk for request redirect to an existing API backend. I have enable the quotas for limit requests of each developer.
Sometimes the API throw exceptions 40x, for wrong input or backend error: tyk in that case, decrement the quota_remaining.
There is a way to avoid this behaviour?
Do you have any idea how to solve this problem ?
Hello @Michal_Gorski and welcome to the community
I don’t think this is possible via Tyk out of the box. Rate limit and quota updates occur on the request (after authentication but) before it is proxied upstream. As such the quota is considered/deducted before a response is received.
You could achieve your goal with the help of custom plugins especially with golang or python. The crux of the involve making a seperate connection to redis and then modyfing the key with
quota- prefix. You can find more infor about quotas here . The gist of it all is
key.quota_remaining = key.quota_max - quota