Closed TheAwiteb closed 2 years ago
Maybe I'm wrong, but it looks to me like this isn't standardized yet. Yet, if someone wants to contribute an option for enabling reasonable non-standard headers, like x-ratelimit-limit
, I'd be happy to merge this.
if someone wants to contribute an option for enabling reasonable non-standard headers, like
x-ratelimit-limit
, I'd be happy to merge this.
I'm trying to do this but I couldn't reach the max request limit and how many request are left, can you help me.
here
https://github.com/AaronErhardt/actix-governor/blob/main/src/lib.rs#L485-L488
and here
https://github.com/AaronErhardt/actix-governor/blob/main/src/lib.rs#L509-L518
What you need to do is to add a StateInformationMiddleware as fourth generic argument to the RateLimiter. Ideally, the default should still be NoOpMiddleware so you will likely have to add another generic type to GovernorMiddleware
.
With the StateInformationMiddleware you should be able to get a StateSnapshot with all the information you need. You only need to match against Ok(state_snapshot)
here: https://github.com/AaronErhardt/actix-governor/blob/main/src/lib.rs#L485
Let me know if there are any other questions :)
Let me know if there are any other questions :)
How can i fix this 🙂
How can i fix this slightly_smiling_face
yesssssss i solve it with with_middleware
I did a PR #18 but it's incomplete, it just needs to bring the response here
Fix in #21
There is no rate limits headers 😢