You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For an unauthenticated request for sending help forms, I need a rate limit.
But the limit should only be applied if the request was successful (Calls that returns a validation error, should not be counted).
For this, it would be great to get the response into the rate limit callback, which currently is not passed through.
The following Code shows my idea:
RateLimiter::for('forms', function (Request$request, Response$response) {
// $response is not available here.if ($response->status() === 429) {
return Limit::none();
}
return Limit::perMinute(2)->by("forms-ratelimit-{$request->ip()}");
});
Do you think that this should be possible?
I could start a PR that changes the following line to the following
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Guys
For an unauthenticated request for sending help forms, I need a rate limit.
But the limit should only be applied if the request was successful (Calls that returns a validation error, should not be counted).
For this, it would be great to get the response into the rate limit callback, which currently is not passed through.
The following Code shows my idea:
Do you think that this should be possible?
I could start a PR that changes the following line to the following
framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php
Line 85 in 277c2fb
But this feels wrong to me in terms of performance...
Maybe someone has another idea how to solve this?
Beta Was this translation helpful? Give feedback.
All reactions