1 Answer
- Newest
- Most votes
- Most comments
0
I figured this out. I was signing my url with a specific subdomain 'premium.example.com' and tried to access another, 'paid.example.com'
$resourceKey = 'https://premium.example.com/*;
$expires = time() + 3000;
$privateKey = config('services.cloudfront.pem');
$keyPairId = config('services.cloudfront.key_id');
$cloudFrontClient = new CloudFrontClient([
'version' => config('services.cloudfront.version'),
'region' => config('services.cloudfront.region')
]);
$policy = '{"Statement":[{"Resource":"'.$resourceKey.'","Condition":{"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}';
return $cloudFrontClient->getSignedCookie([
'private_key' => $privateKey,
'expires' => $expires,
'key_pair_id' => $keyPairId,
'policy' => $policy
]);
I need to access multiple secure domains so I ended up using a wildcard subdomain and it works great.
$resourceKey = 'https://*.example.com/*;
answered 10 months ago
Relevant content
- asked 2 years ago
- Accepted Answerasked 3 years ago
- Accepted Answerasked 3 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago