-
Notifications
You must be signed in to change notification settings - Fork 204
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
More complex limits #62
Comments
@Hubro Sorry for the late reply, somehow I wasn't notified by GitHub. At it's core, Tollbooth is nothing but key-value in-memory storage with TTL. To accomplish what you want, you need to construct your own keys and run Re-wrapping 3 times (as what you did in the example), will simply override your key three times, which means the last one set wins (the second limiter one). I hope that make sense. |
it seems not support complex limits, the above code only limit 1 per second |
How did you solve it? |
For my login API endpoint, I want to allow 1 login attempt per second, 5 attempts per hour and 10 attempts per 24 hours.
I have read through the README example and I've looked through the API, and I can't see any way to achieve this. My apologies in advance if I'm just being thick, but is this possible using this library? Would I have to stack 3 levels of the middleware?
Here's where I'm at:
And it's only blocking 1 request per second, it's not blocking anything hourly or daily. Tested by sending 10 requests in 10 seconds.
The text was updated successfully, but these errors were encountered: