问题
Is it possible to generate pre-signed URLs for CDNs (i.e., CloudFront?), or can I append pre-signed URL parameters to a CloudFront URL to use instead?
Example:
string url = amazonS3Client.generatePresignedUrl(generatePresignedUrlRequest);
returns:
url = "https://bucket-name.s3.amazonaws.com/file.txt?AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Expires=1111111111&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Can I take the URL parameters and append to corresponding CloudFront URL:
https://00000000000000.cloudfront.net/file.txt?AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Expires=1111111111&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Will this work to allow download of the file?
回答1:
FYI if you only want the network optimization, and not the edge caching, you can also consider using "Amazon S3 Transfer Acceleration": https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html
This allows you to keep using S3 signatures, rather than having to implement Cloudfront signatures.
See my answer here for more details: https://stackoverflow.com/a/54139603/8046487
来源:https://stackoverflow.com/questions/40093881/pre-signed-s3-urls-with-cloudfront-cdn