Laravel: The hidden SetCacheHeaders Middleware
https://medium.com/@DarkGhostHunter/laravel-the-hidden-setcacheheaders-middleware-4cd594ba462f
FOUND YOU!There are a lot of useful middlewares already registered inside Laravel, like the authentication mechanisms, authorization, a throttler, and even the one responsible to make route model binding possible. Practically, your middleware needs are covered. Except for one.
There is one middleware that doesn’t get the spotlight in Laravel. It’s called SetCacheHeaders, which is aliased as cache.headers. And, there is no mention of it in the documentation. I’m not joking, guys: