fix: Move RateLimiter configuration to AppServiceProvider #205
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The application was crashing with a fatal error:
RuntimeException: A facade root has not been setinbootstrap/app.phpat line 34. This prevented Laravel from starting correctly and also broke Laravel Boost MCP.The error occurred because
RateLimiter::for()was being called in thewithMiddleware()callback inbootstrap/app.phpbefore the application was fully booted, making facades unavailable at that point in the application lifecycle.Solution
Moved the
RateLimiter::for()calls frombootstrap/app.phptoAppServiceProvider::boot()where facades are properly initialized and available.Changes
bootstrap/app.php
RateLimiter::for()calls fromwithMiddleware()callbackIlluminate\Cache\RateLimiting\Limit,Illuminate\Http\Request,Illuminate\Support\Facades\RateLimiterapp/Providers/AppServiceProvider.php
Limit,Request, andRateLimiterboot()method:apirate limiter: 60 requests per minute per user/IPpassword-resetrate limiter: 5 requests per 60 minutes per IPVerification
php artisan --versionworksImpact
This is a critical bugfix that restores application functionality. No behavior changes - rate limiting configuration remains identical, just moved to the correct location in the application lifecycle.