optimistdigital/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).

Maintainers

Package info

github.com/outl1ne/laravel-set-cache-headers

pkg:composer/optimistdigital/laravel-set-cache-headers

Statistics

Installs: 177

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0 2020-04-01 07:34 UTC

This package is auto-updated.

Last update: 2026-02-25 04:17:26 UTC


README

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: laravel/framework#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,
        // ...
    ];