Does Chrome cache a downloaded file?

Pretty bizarre.

In my webapp, I have a link to a spreadsheet that's stored in S3. I have downladed that file before. Now, I updated that file in s3.

When I try to download it again from the same link, I still get the previous version.

If I clear the cache, it will download the newer version...


You have two choices to work around this:

  1. You can tell Amazon how to set the Cache-Control header when your URL is retrieved. The same way you specify the Content-Type header, you can control other headers as well. You can turn the caching down to a much shorter time interval.

  2. You can control the caching of the web page that links to the file on S3 and modify the link to the S3 file so that its contents won't be used from cache when the file changes. Basically, you can just put a ?version=1 on the end of the URL. If you change that to ?version=2 (and so on), the browser won't use the cached version of the file because the URL won't precisely match.

This second method allows you to use aggressive caching on the S3 file and avoid wasted transfers. But it requires you to modify every web page that links to the file every time you change the contents of the file.

See Lower your Amazon S3 Bill for more on both techniques, though you're trying to get the opposite effect.


Yes it does. I am having the same issue even if i am not using S3 as storage. I have a Symfony2 app that serves the contents of a local file for download. The url is always the same because i am getting the contents of the file in PHP and send them to the browser. If i modify the content of the local file, Firefox and IE will receive the latest file version BUT chrome won't. I tried to set cache control headers but it's useless, Chrome just ignores them.

Some idea of the headers i am using:

$response->headers->addCacheControlDirective('no-cache', true);
$response->headers->addCacheControlDirective('max-age', 0);
$response->headers->addCacheControlDirective('must-revalidate', true);
$response->headers->addCacheControlDirective('no-store', true);

If i add a random version number to the url (?version=randomIntByTime) Chrome will finally save the latest version of the file. It is frustrating to write extra code for Chrome.