Description
What is your question?
I would like to know if I am missing something.
If a user has already called for a given version of an image, say 300x300, CloudFront will cache it and serve it to all users requesting the same variant. This is, of course, the desired behaviour.
However, if an admin updates the image in S3 (with or without versioning on the bucket) then of course the image in the CDN is now "invalid".
Does the solution provide a way in the base64 object or via the queryString to invalidate the cache and ensure that new versions of the image are created when requested?
This does appear challenging to implement for a number reasons:
- We do not want to make a call to S3 on every request
- We do not want users to commonly be able to bypass the cache as this defeats one goal of the solution
- The solution would somehow have to track the relationship between cached variants and the original
Our solution to this is to hold an assetId in our product catalog that is independant of the productId and thus if a new image is uploaded then a new object is loaded to S3 and all is well.