From c84b1b4b53ed330359fb62e18cdced2c1ff23ca1 Mon Sep 17 00:00:00 2001 From: EarthlingDavey <15802017+EarthlingDavey@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:38:41 +0000 Subject: [PATCH] Extend the CloudFront cookie, and always send it on every request. (#798) --- .../clarity/inc/amazon-s3-and-cloudfront-signing.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/public/app/themes/clarity/inc/amazon-s3-and-cloudfront-signing.php b/public/app/themes/clarity/inc/amazon-s3-and-cloudfront-signing.php index 9720e2a48..695633777 100644 --- a/public/app/themes/clarity/inc/amazon-s3-and-cloudfront-signing.php +++ b/public/app/themes/clarity/inc/amazon-s3-and-cloudfront-signing.php @@ -31,7 +31,7 @@ class AmazonS3AndCloudFrontSigning private mixed $cloudfront_host; private string $cloudfront_url; - const CLOUDFRONT_DURATION = 60 * 15; // 15 minutes - important that this is at least nginx cache (10mins) + TRANSIENT_DURATION (2mins) + const CLOUDFRONT_DURATION = 60 * 20; // 20 minutes - important that this is at least nginx cache (10mins) + TRANSIENT_DURATION (2mins) const CLOUDFRONT_REFRESH = 60 * 5; // 5 minutes const TRANSIENT_DURATION = 60 * 2; // 2 minutes @@ -295,15 +295,7 @@ public function handlePageRequest(): void // Clear the production session cookie - avoid sending conflicting cookies to CloudFront. $this->maybeClearProductionCookies(); - $remaining_time = $this->remainingTimeFromCookie(); - - if ($remaining_time && $remaining_time > $this::CLOUDFRONT_REFRESH) { - // Cookie-Policy exists, and it's not time to refresh it. - return; - } - // If we're here, then we need to send a cookie to the user. - $cookies = $this->getSignedCookie(); // Properties for the cookies.