From 57936276adb59cf6f4ff034afcb11a8d3e19f90c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Sep 2024 23:19:44 +0200 Subject: [PATCH] Add support for `s-maxage` --- src/HTTP/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HTTP/Utils.php b/src/HTTP/Utils.php index 666702c22..f0a1b5e6e 100644 --- a/src/HTTP/Utils.php +++ b/src/HTTP/Utils.php @@ -43,7 +43,7 @@ public static function negociate_cache_expiration_time(array $http_headers, int if (preg_match('/\bmust-revalidate\b/', $cache_control)) { $cache_duration_min = 0; } - if (preg_match('/\bmax-age=(\d+)\b/', $cache_control, $matches)) { + if (preg_match('/\bs-maxage=(\d+)\b/', $cache_control, $matches) || preg_match('/\bmax-age=(\d+)\b/', $cache_control, $matches)) { $max_age = (int) $matches[1]; $age = $http_headers['age'] ?? ''; if (is_numeric($age)) {