Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add ThrottleRequestsWithRedis to $middlewarePriority #39316

Merged
merged 2 commits into from
Oct 22, 2021
Merged

[8.x] Add ThrottleRequestsWithRedis to $middlewarePriority #39316

merged 2 commits into from
Oct 22, 2021

Conversation

paulandroshchuk
Copy link
Contributor

Laravel has a property where we can configure middleware ordering. By default, it sets up a priority for the ThrottleRequests middleware but that variable doesn't set up any default priority for the sibling ThrottleRequestsWithRedis middleware.

What means when somebody is switching to use Redis for throttling, it kind of deletes the ordering of the throttle middleware as there's no default priority set up for the ThrottleRequestsWithRedis middleware.

This PR adds that middleware to the default middleware priority property to make sure the "throttle" middleware does not go away after switching throttling to Redis.

As an alternative solution, we can create an interface for these two middleware as Laravel can order by interface as well.


Also, pretty sure there's some projects that have defaulted $middlewarePriority and switched to ThrottleRequestsWithRedis but have not noticed/reflected this switch in their default $middlewarePriority.

And if this PR gets merged, should we also update this documentation block? https://laravel.com/docs/8.x/middleware#sorting-middleware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants