Skip to content

Commit

Permalink
Extend the CloudFront cookie, and always send it on every request. (#798
Browse files Browse the repository at this point in the history
)
  • Loading branch information
EarthlingDavey authored Dec 2, 2024
1 parent 9c72f48 commit c84b1b4
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit c84b1b4

Please sign in to comment.