I'm trying to use browser canvas to manipulate images I have hosted on cloudfront. I'm trying to setup cloudfront to have the browser cache images with cache control max-age and still allow canvas to edit those images.
Here's an image that I can edit:
https://d2t4fc8ff77neh.cloudfront.net/cardSrcImage/1ac01l796_16dbmg07t_books2.jpg
Here's one that I can't (Image from origin 'https://d2t4fc8ff77neh.cloudfront.net' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost' is therefore not allowed access.):
https://d2t4fc8ff77neh.cloudfront.net/cardSrcImage/1ac01o3l0_16dbmg07t_books2.jpg
The only thing different is the cache-controls header. What's wrong? Thanks.
I'm using the node.js knox library to upload. Example headers:
var headers = {
'Content-Length': options.data.length,
'Vary': 'Accept-Encoding',
// 'Cache-Control': 'public, max-age=31536000',
'x-amz-acl': 'public-read',
'Content-Type': options.type
}
'Access-Control-Allow-Origin': '*'to yourheadersobject; this allowsCORSfor everyone, but could at least rule out that issue. - Castaglia