From 82fa4ac9e8f399e0fed326a11fd3ad66bf156de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Birkl=C3=A9?= Date: Mon, 27 Nov 2023 15:33:02 +0100 Subject: [PATCH] Fix middleware "SetCacheHeaders" with download responses (#49138) --- Middleware/SetCacheHeaders.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Middleware/SetCacheHeaders.php b/Middleware/SetCacheHeaders.php index 2a7a13ba..6229e4cf 100644 --- a/Middleware/SetCacheHeaders.php +++ b/Middleware/SetCacheHeaders.php @@ -6,6 +6,7 @@ use Illuminate\Support\Carbon; use Illuminate\Support\Str; use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\StreamedResponse; class SetCacheHeaders { @@ -41,7 +42,7 @@ public function handle($request, Closure $next, $options = []) { $response = $next($request); - if (! $request->isMethodCacheable() || (! $response->getContent() && ! $response instanceof BinaryFileResponse)) { + if (! $request->isMethodCacheable() || (! $response->getContent() && ! $response instanceof BinaryFileResponse && ! $response instanceof StreamedResponse)) { return $response; }