From 33bf082ad39ef2bfa5a9ef9d76fc486e1bb90d20 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Fri, 12 Sep 2025 07:30:09 +0000 Subject: [PATCH] added cache to the showAction to reduce network requests --- application/File/FileController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/File/FileController.php b/application/File/FileController.php index 158913a55..ee57bcc33 100644 --- a/application/File/FileController.php +++ b/application/File/FileController.php @@ -99,7 +99,9 @@ class FileController extends mfBaseController { $originalPath = MFUPLOAD_FILE_SAVE_PATH . ($file->subfolder ? "/{$file->subfolder}" : "") . "/{$file->store_filename}"; if (!is_readable($originalPath)) self::sendError("Physical file not found"); - + header("Cache-Control: public, max-age=604800"); + header("Expires: " . gmdate("D, d M Y H:i:s", time() + 604800) . " GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s", filemtime($originalPath)) . " GMT"); $imageInfo = @getimagesize($originalPath); @@ -140,4 +142,4 @@ class FileController extends mfBaseController { readfile($cachedPath); exit; } -} \ No newline at end of file +}