schutte
schutte

Reputation: 2156

How to disable throttle in specific routes? (laravel)

Can we disable the laravel's throttle in a specific group of routes?

Here are my codes:

Route::group(['middleware' => ['auth:sanctum']], function () {
    Route::get('/sample1', 'SampleController@sample');
    // more routes here
});

I want to disable throttle limiter in all routes wrap inside Route::group. Can we possibly do that?

Upvotes: 9

Views: 2929

Answers (1)

John Lobo
John Lobo

Reputation: 15319

If you are using Latest laravel version then you disable throtle for specific route group.

You can exclude throttle:api middleware for specific route group using excluded_middleware

Route::group([
'middleware' => ['auth:sanctum'],
'excluded_middleware' => 'throttle:api'], function () {
      Route::get('/sample1', 'SampleController@sample');
    });

Upvotes: 9

Related Questions