From 471589cc57f5c76d8048f79d6e59f538cbc858e3 Mon Sep 17 00:00:00 2001 From: Siau Pheng Date: Wed, 4 Nov 2026 15:35:32 +0700 Subject: [PATCH] Add Cache-Control and Pragma headers for improved caching in routes --- app/Scripts/system/about.js | 1 + app/config/routes.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/Scripts/system/about.js b/app/Scripts/system/about.js index 0856079..9994293 100644 --- a/app/Scripts/system/about.js +++ b/app/Scripts/system/about.js @@ -115,4 +115,5 @@ var AboutJS = { } }).send(); } + }; diff --git a/app/config/routes.php b/app/config/routes.php index 628fef8..a3a12eb 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -131,6 +131,8 @@ $router->group('', function(Router $router) use ($app, $session, $config) { if (str_ends_with($filePath, '.js')) $mimeType = 'application/javascript'; if (str_ends_with($filePath, '.css')) $mimeType = 'text/css'; $app->response()->header('Content-Type', $mimeType.'; charset=utf-8'); + $app->response()->header('Cache-Control', 'public, max-age=864000'); + $app->response()->header('Pragma', 'cache'); if (function_exists('gzencode') && str_contains($_SERVER['HTTP_ACCEPT_ENCODING'] ?? '', 'gzip')) { $app->response()->header('Content-Encoding', 'gzip'); echo gzencode(file_get_contents($filePath), 9);