I'm using carrierwave to allow users to upload images with an ability to crop after upload, the issue is the versions get created and CDN catch them instantly that when users crop they don't see changes because the Cloudfront cache has to be invalidated and takes quite a decent time to refresh on its own.
I thought putting version numbers on file names might be a good way to sorta invalidate cache, how to achieve that using Carrierwave?
And is that the best approach?
I had the same issue with cloudflare
here my hackish solution: put the updated_at timestamp in a params. Should work with all CDN
class AssetUploader < CarrierWave::Uploader::Base
def url(options={})
super.split("?v=")[0]+"?v=#{model.updated_at.to_time.to_i}" rescue super
end
end