Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling S3 Cache

I have static files located on Amazon S3, and am continually having issues with Amazon caching them. When I update/overwrite the static file, I'd love for it to automatically show the newest version rather than waiting...

Any ideas?

like image 279
Brett Sinn Avatar asked Jul 30 '10 16:07

Brett Sinn


People also ask

Does S3 cache by default?

By default, CloudFront caches a response from Amazon S3 for 24 hours (Default TTL of 86,400 seconds). If your request lands at an edge location that served the Amazon S3 response within 24 hours, then CloudFront uses the cached response. This happens even if you updated the content in Amazon S3.

How do I disable CloudFront caching?

On your custom origin web server application, add Cache-Control no-cache, no-store, or private directives to the objects that you don't want CloudFront to cache. Or, add Expires directives to the objects that you don't want CloudFront to cache.

How do you turn off cache on Galaxy S3?

you can set Cache-Control as Metadata on S3 using Bucket Explorer, or S3 Broswer. bucketexplorer.com is not available anymore. See docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/… to disable the cache of an object.


2 Answers

I'm using the Javascript SDK and was able to resolve the problem by setting GetObject()'s ResponseCacheControl parameter to "no-cache".

like image 79
Caleb Koch Avatar answered Oct 17 '22 16:10

Caleb Koch


Add to the parameters of putObject() or upload() the following:

CacheControl: "no-cache"
like image 20
m.e Avatar answered Oct 17 '22 15:10

m.e