Skip to content

Cloudfront does not invalidate cache (s3 origin)

0

I am facing issues when updating files in Cloudfront. I have already created an invalidation matching for the target file or wild card for the entire path, both without success. Already tried to change behavior to set 'cache-disabled' , but still with the same problem.

Also, I have added a new file to existing path in S3, but I could not retrieve using route53 address , only when I use s3 origin address. Any idea about what is happening here?

Thanks in advance.

asked a year ago629 views
1 Answer
0

It seems you're experiencing a few issues with CloudFront caching and file retrieval. Let's address these one by one:

  1. Invalidation not working: If you've created an invalidation for the specific file or used a wildcard for the entire path and it's not working, there could be a few reasons:
  • Ensure that the invalidation path is case-sensitive and matches exactly with the file path in your distribution.
  • If you're using query strings or cookies in your CloudFront configuration, make sure to include them in your invalidation path.
  • Check if you've reached the maximum number of allowed invalidations. If so, you may need to wait for previous invalidations to complete.
  1. Cache-disabled behavior not working: Setting a cache behavior to 'cache-disabled' should prevent caching, but if you're still seeing old content, it's possible that:
  • The changes haven't propagated to all edge locations yet. This can take some time.
  • There might be caching happening at other levels, such as at the browser or intermediate proxies.
  1. New file not accessible via Route 53: If you can access the new file using the S3 origin address but not through the Route 53 address, this suggests a potential issue with your CloudFront distribution or DNS configuration:
  • Verify that your CloudFront distribution is properly linked to your Route 53 record.
  • Check if the new file's path is included in the path pattern of an existing cache behavior in your CloudFront distribution.
  • Ensure that your CloudFront distribution is in the "Deployed" state and not "In Progress".

To troubleshoot further:

  • Double-check your CloudFront distribution settings, especially the origin and behavior configurations.
  • Verify that the S3 bucket permissions allow CloudFront to access the files.
  • Try clearing your browser cache and testing from a different network to rule out local caching issues.
  • Use the CloudFront console to check the status of your invalidations and distribution.
  • Consider using versioning for your S3 objects or adding a version identifier to your file names to bypass caching issues.

If these steps don't resolve the issue, you may need to contact AWS support for more in-depth troubleshooting of your specific configuration.
Sources
What you need to know when invalidating files - Amazon CloudFront
Add, remove, or replace content that CloudFront distributes - Amazon CloudFront
Request and response behavior for Amazon S3 origins - Amazon CloudFront

answered a year ago
EXPERT
reviewed a year 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.