Disable rate limiter in Laravel?

Disable rate limiter in Laravel?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Disable rate limiter in Laravel?

When testing an endpoint that expects to handle high throughput, you might find yourself staring at a wall of 429 Too Many Attempts responses. This isn't a bug in your application logic; it is the built-in Throttling Middleware protecting your routes. By default, Laravel applies this middleware to every route unless explicitly configured otherwise. If you are trying to simulate load or debug an endpoint that should technically accept more requests than the current limit allows, simply ignoring these responses won't give you the data you need. You have to tell Laravel to skip the rate limiting check for specific paths.

The most straightforward way to achieve this is by removing the throttle middleware from your route group or individual controller actions. The default configuration in Laravel typically groups routes with web, while API routes often include throttle:api. If you are working within a standard routes/api.php file, you will likely see middleware definitions applied to the entire group at the top of the file.

To disable rate limiting for a specific route or a set of routes, you can modify the middleware stack in your route definition. Consider the following scenario where you have a controller that needs to accept unlimited requests during testing:

Route::get('/api/health-check', [HealthController::class, 'check'])
    ->withoutMiddleware(\Illuminate\Routing\Middleware\ThrottleRequests::class);

This approach is surgical and precise. You are explicitly telling the router not to apply the ThrottleRequests middleware to this specific path. The application will continue to function normally for all other requests, maintaining the security and stability features that rate limiting provides in production.

Alternatively, if you need to disable throttling for an entire section of your API, such as a testing environment or a public-facing status page, you can define a middleware group without the throttle constraint. You might create a dedicated route group in routes/api.php:

Route::middleware(['throttle:api'])->group(function () {
    // Standard protected routes
});

Route::middleware([])->group(function () {
    // Routes that should never be throttled, even if they hit the same queue
    Route::get('/debug-load-test', [LoadTestController::class, 'process']);
});

In this setup, the first group retains the default throttle:api configuration, which defaults to 60 requests per minute for API routes. The second group has an empty middleware stack, effectively bypassing the rate limiter entirely. This is useful when you want to isolate specific endpoints that are known to be sensitive to load or require extensive manual testing without artificial interruptions.

It is important to understand the trade-offs of disabling this protection. Rate limiting exists primarily to prevent abuse and ensure fair resource distribution among users. By removing it, you open your application to potential DoS attacks if left in a production environment. Therefore, this configuration should almost exclusively be used within non-production environments or for specific, trusted endpoints where the business logic explicitly requires unlimited access.

If your goal is simply to verify that an endpoint can handle high concurrency without hitting artificial caps, removing the middleware is the correct technical step. However, once testing is complete, ensure you re-enable the middleware group in your production build configuration. You can do this by commenting out the withoutMiddleware directive or switching back to the standard throttle:api group when deploying to a live server.

For more complex scenarios where you want to keep global throttling but allow exceptions for specific IPs or user agents, Laravel does not provide a built-in "allowlist" middleware that sits naturally alongside the throttle logic without custom code. In those cases, wrapping your controller method in a ShouldHandle trait or creating a custom middleware class is often cleaner than trying to patch the core throttling behavior.

If you need further assistance configuring complex middleware stacks or need help setting up a testing environment that mimics production constraints accurately, LaravelCompany offers resources on optimizing Laravel applications for high-load scenarios. Their documentation covers best practices for scaling and maintaining performance under stress.

Our network