Looking to hire Laravel developers? Try LaraJobs

laravel-set-cache-headers maintained by optimistdigital

Description
This Laravel package is a bug fix for not caching successful responses, especially the ones with the HTTP status code 204 (No Content).
Author
Last update
2020/04/01 09:34 (dev-master)
License
Links
Downloads
177

Comments
comments powered by Disqus

Laravel SetCacheHeaders middleware

tests

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,
        // ...
    ];