Disable rate limiter in Laravel?
In app/Http/Kernel.php
Laravel has a default throttle limit for all api routes.
protected $middlewareGroups = [
...
'api' => [
'throttle:60,1',
],
];
Comment or increase it.
You can use cache:clear
command to clear your cache including your rate limits, like so:
php artisan cache:clear
Assuming you are using the API routes then you can change the throttle in app/Http/Kernel.php or take it off entirely. If you need to throttle for the other routes you can register the middleware for them separately.
(example below: throttle - 60 attempts then locked out for 1 minute)
'api' => [
'throttle:60,1',
'bindings',
],
You can actually disable only a certain middleware in tests.
use Illuminate\Routing\Middleware\ThrottleRequests;
class YourTest extends TestCase
{
protected function setUp()
{
parent::setUp();
$this->withoutMiddleware(
ThrottleRequests::class
);
}
...
}