Return a Cache-Control header for files served via the API

This commit is contained in:
Bernd Bestel
2019-09-24 10:38:41 +02:00
parent 50e829f270
commit 49b26bd375
2 changed files with 2 additions and 0 deletions

View File

@@ -81,6 +81,7 @@ class FilesApiController extends BaseApiController
if (file_exists($filePath))
{
$response->write(file_get_contents($filePath));
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
}