I'm trying to get static assets set up to be served by CloudFront. I know how to get the S3 bucket working, and have CloudFront serving from that bucket, but what I can't wrap my head around is how to handle the invalidation. In non-Craft instances I know about hashing to trigger the invalidation, but not sure how to do that in Craft.

Specifically, if an editor uploads a photo named "photo.jpg", and then publishes, and decides to make a change and uploads the revised photo with the same name, how does CloudFront know that it has changed since the editors don't know about content hashing?

Hopefully this makes sense. While not at all new to Craft, I'm very new to running it with performance in mind and even newer to using a CDN. Any help is greatly appreciated!

2 Answers 2


One way would be to manually clear it with Cloudfront Invalidation.

  • Is there another option for Craft 3? Commented Jun 13, 2019 at 9:29
  • I believe its built in to the S3 plugin? Commented Jun 22, 2019 at 11:53

Your best option for Craft 3 is to use Blitz and the Cloudfront Blitz Plugin.

This combination will allow your craft instance to automatically expire CloudFront caches as needed, or clear the entire CloudFront cache from the CraftCMS CP.

  • Unless I'm missing something, Blitz only handles page caching, not assets? Commented Sep 16, 2021 at 15:56
  • That depends on your cloudfront configuration -- If you're serving assets via the same domain/server blitz can reset the entire cloudfront cache. Commented Sep 16, 2021 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.