diff --git a/src/Middleware/StaticContent.php b/src/Middleware/StaticContent.php index 39b6d36..f5d6665 100644 --- a/src/Middleware/StaticContent.php +++ b/src/Middleware/StaticContent.php @@ -75,7 +75,9 @@ public function __invoke(ServerRequestInterface $request, callable $next = null) if ($realPath !== false && strpos($realPath, $this->publicPath) === 0 && is_file($realPath)) { $extension = pathinfo($realPath, PATHINFO_EXTENSION); $mime = $this->mimeDb->getFromExtension($extension); - $headers = []; + $headers = [ + 'Cache-Control' => 'public, max-age=31536000' //1 year of cache, make sure you change URLs when changing resources + ]; if ($mime !== null) { $headers['Content-Type'] = $mime['name']; }