feat: Add support for unsigned route closures #45527
Closed
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.
Add support for serializing closures in routes unsigned.
This PR depends on the work created in laravel/serializable-closure#62.
The reasoning below is a copy/paste from the other pr.
Why?
When caching routes in the Laravel/framework, they are currently being cached signed. This means if you cache your routes and then set/change your
APP_KEY
your route caches are invalid.This option allows the route caching logic to disable signing when caching the routes, which then means
APP_KEY
can be changed without the route caching being invalid.Usecase
When building a docker image it is currently impossible to cache your routes while building the image (if any routes are closures) as the
APP_KEY
should not be exposed to the build steps of the docker image.Caching the routes while building the image has a lot of advantages, as each instance does not have to cache it themselves. This can also prevent potential crashes of running out of storage when using k8s, as you cannot guarantee the amount of storage available outside of the image size unless you start mounting volumes etc.