WebPagetest Forums
What happens if original file is updated when using Cloudfront? - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Optimization Discussions (/forumdisplay.php?fid=5)
+--- Thread: What happens if original file is updated when using Cloudfront? (/showthread.php?tid=12166)



What happens if original file is updated when using Cloudfront? - Noobadmin - 04-10-2013 02:19 AM

Let’s say we are using Cloudfront with our blog in origin pull and if we update a plugin or wordpress itself, does Cloudfront automatically starts serving the updated files or does its cache needs to be purged, before it will server updated files?


RE: What happens if original file is updated when using Cloudfront? - pmeenan - 04-10-2013 02:34 AM

It depends on your caching headers. Cloudfront will honor your expires and cache-control headers and it's really only effective if the content is cacheable so you will probably need to purge the cache. That said, if you are updating files that require a cache purge then you may not be doing it right because your end user's browsers will also be caching the content and you have no way to force a purge there. Usually you want to be in a position where you are changing the file URL every time the file is changed so it will look like a new file to all of the caches but it can still be cached for a long time.

I do it on WebPagetest by adding a ?v=1234 (some incrementing number for the version) to the end of my files when I change them but you need to modify the HTML or css that references them (and a query string isn't the best way to do it but it's generally easy and transparent).