-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
- Laravel Version: 10.1.5
- PHP Version: 8.2.1
- Database Driver & Version: Redis 6.x
Description:
Reopening #45088 (closed because issue was originally filed under Laravel 8.x). This issue persists in Laravel 10.
Using multiple rate-limiters that use the same key does not work as expected. If the key is the same, only the first rate limiter is ever triggered.
Additionally, because both limiters use the same key, the count of remaining requests is decremented by the amount of times the same key is used.
Steps To Reproduce:
Define a simple rate limiter that returns an array of limits, using the same key.
RateLimiter::for('maps', function (Request $request) {
return [
Limit::perMinute(3)->by($request->ip()),
Limit::perDay(30)->by($request->ip())
];
});The above code will only apply the first limit, but the "Remaining" is decremented by two because both use the same key.
ankurk91
Metadata
Metadata
Assignees
Labels
No labels