Luke Hutton
Luke Hutton

Reputation: 10722

AWS CloudFront website not being updated

Our website hosted on CloudFront has not been updated for almost 24 hours now.

The CloudFront invalidation updated a few of the files. I can see on S3 all of the files have been updated. Performing a GET on these files I can see the timestamps are all correct except for one of the files (a javascript minified file called app.min.js) which still has an old timestamp on it. However, looking at S3, the app.min.js file has the correct updated timestamp. Forcing a no cache on the file, the app.min.js still reflects the old file.

Does anyone have any suggestions on what could be happening here?

Upvotes: 1

Views: 1658

Answers (1)

Matt Houser
Matt Houser

Reputation: 36113

Your files are still being cached somewhere. If it's not cached in CloudFront, it may be cached in your browser or somewhere else between CloudFront and you.

Invalidating the CloudFront distribution does not invalidate the cache in your browser. So make sure you're using a fresh browser to test this. Better yet, use curl.

  • Invalidate CloudFront again
  • Restart your browser
  • Use a different browser
  • Use a different computer
  • Use curl to avoid local caches

Do anything to eliminate the possibility of hitting a cached version.

Also:

  1. Adding "no cache" to a file on S3 won't have any effect on the cached version in CloudFront. You'll need to invalidate the cache again to force CloudFront to get the new version.
  2. The default TTL for CloudFront is 24 hours. So once it hits 24 hours, it should re-get the file from the origin. You can look at the headers to see how long it will be before the TTL runs out.

Upvotes: 2

Related Questions