How do edge locations deal with corrupt files?

I’ve got a client that is using Cloudfront. One day last week, an edge location got a corrupted version of a javascript file which took their site offline for around 30 mins for people in a small area close to the edge location. Then the edge location pulled the correct file and all is right with the world.

However, the client wants to know a few things:

  1. How did the cache resolve itself?

  2. Is there a way to flag an edge location as unusable?

My thought on #1 is there is probably a system where hashes of files are compared between edge locations and and if a file does not match the majority, it’s re-downloaded (this is just an idea and I have no idea if this is accurate)

My thought on #2 is beyond selecting regions when you set up a cloudfront distribution, you have no say on what edge locations your distribution uses.

Does anyone know the answer to these questions?

Thanks!

  1. Cache TTL expired after 30mins
  2. Nope, just invalidate it globally.

For #2, I have never used cloudfront, but there seems to be an invalidation system you can use:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-clear-cache/

Other posters answered your question, but I’m curious how they arrived at that root cause. Do they actually have evidence of a scrambled/fragmented JavaScript file? Did it exist at the origin in that corrupt state maybe during a deployment process if the origin is something other than S3, or are they thinking it was corrupted within CloudFront?

Thanks!

Thanks!

So, they had a lambda@edge function that does some redirects to index.html. We don’t know why the javascript file errored as it existed, but for some reason, it errored and the lambda redirected it to the index.html. Looking at a users session that hit that edge node, the javascript file contained the contents of the index.html file.

np good luck