-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Quota Consumer For Each Request #5
Comments
Hey @senolatac Yes you're in custom plugin territory at this point. You can change the key objects directly from the plugin so can increment the quota counter by each of the possible values depending on your path/method etc. If you write something in Go and it's sturdy we always consider inclusion into the main set of Gateway middlewares if it is a general solution for users. Or we can include any plugin solutions you come up with in this plugins meta repository. |
Hey @joshblakeley, Actually, currently I try tyk-cloud and I want to implement this option. Is it possible with tyk-cloud? or is it possible only on-premise? |
Yep you can use plugins in cloud with the caveat that we need to load the code from trusted sources so you use our Mserv tool to get your custom code on S3 and then we pull from there to the gateways. Docs are here https://tyk.io/docs/tyk-cloud/using-plugins/ |
Alright, how can I debug the request? Is it possible? (Because I should figure out request counter header) |
On the cloud gateways hosted by Tyk it's just javascript and python currently (and Go too but it's a little more experimental) - though if you run a hybrid gateway then all plugin types will work. You could do it without any special header if you wanted too - set the quota for a key to the GCF of the various weights and then just add them per path per request by modifying that key, there is an SDK for the javascript plugins for example that lets you call up and edit a key by some ID - that way you take advantage of the native quota mechanism. For the development phase you could just run the APIs with the plugin on a local gateway just using the open source GW since it will operate exactly the same as on cloud. |
@joshblakeley I couldn’t get the exact idea in here.
I think in here the important thing is quota counter. Am I handle it via Do you mean like this? |
@joshblakeley I think that there is misunderstanding in here. Let me explain my ideal scenario:
|
We would like to set custom quota usage per endpoint.
For example endpoint "xxx" will use 1 point per request, whereas endpoint "yyy" will use 5 point per request. And if the user has 100 quota limit, he can call 100 "xxx" requests or 20 "yyy" requests. Or 20 "xxx" and 16 "yyy" requests.
Is it implementable with custom-plugins?
The text was updated successfully, but these errors were encountered: