Cloudfront serving a different version of content from an S3 bucket

0

Hello, we updated some files related to a website in an s3 bucket such as index.html for example, the intention would be to update a tag on a social network, I noticed that through the url of the bucket itself the value was updated, however When accessing via the DNS configured on a Route53, I'm not getting the same result. I've already tried to invalidate the cache for CloudFront but I wasn't very successful.

I noticed that the other html files that I updated also had the same behavior, when accessing the s3 url I have the new version, otherwise I have a different version.

Carlos
asked 17 days ago135 views
2 Answers
1

Hi,

Go to your CloudFront distribution in the AWS Management Console. Navigate to the "Invalidations" tab and create a new invalidation for the files you've updated (e.g., /index.html). This tells CloudFront to fetch fresh copies from the S3 bucket. After invalidating, wait for a few minutes for the changes to take effect. Sometimes it can take a bit of time for CloudFront to clear its cache. Make sure your S3 bucket is sending appropriate Cache-Control headers. You can set them to no-cache to ensure CloudFront always fetches the latest version. Check if the updated files are accessible directly from the S3 bucket URL. If they are, then the issue is likely with CloudFront caching.

please look at this link https://repost.aws/knowledge-center/cloudfront-serving-outdated-content-s3.

answered 17 days ago
profile pictureAWS
EXPERT
reviewed 17 days ago
0

Hi

As I understand that you already invalidate the cache,

Even though you invalidated the cache, it might take some time (around 5 minutes) for the invalidation to propagate across all CloudFront edge locations.

Here is the link https://repost.aws/knowledge-center/cloudfront-serving-outdated-content-s3 to give you clear information about the solution

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/UpdatingExistingObjects.html#ReplacingObjects

How best to serve versioned S3 files from CloudFront

profile picture
EXPERT
GK
answered 17 days ago
profile pictureAWS
EXPERT
reviewed 17 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions