https://github.com/outl1ne/laravel-set-cache-headers
This Laravel package is a bug fix for not caching successful responses, especially the ones with the HTTP status code 204 (No Content).
https://github.com/outl1ne/laravel-set-cache-headers
Last synced: 3 months ago
JSON representation
This Laravel package is a bug fix for not caching successful responses, especially the ones with the HTTP status code 204 (No Content).
- Host: GitHub
- URL: https://github.com/outl1ne/laravel-set-cache-headers
- Owner: outl1ne
- License: mit
- Created: 2020-04-01T07:10:33.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T07:38:38.000Z (about 5 years ago)
- Last Synced: 2025-01-13T17:17:58.154Z (5 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel SetCacheHeaders middleware

This Laravel package is a bug fix for not caching successful responses, especially the ones with the HTTP status code 204 (No Content).
See issue: https://github.com/laravel/framework/pull/32178
## Requirements
* Laravel 6.0+, probably works with older ones as well
## Usage
```
composer require optimistdigital/laravel-set-cache-headers
```Swap out SetCacheHeaders middleware in `app/Http/Kernel.php` in your Laravel application:
Before:
```
protected $routeMiddleware = [
// ...
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
// ...
];
```After
```
protected $routeMiddleware = [
// ...
'cache.headers' => \OptimistDigital\SetCacheHeaders\Http\Middleware\SetCacheHeaders::class,
// ...
];
```