I\'m hosting a static website in S3 and using Cloudfront to cache files. I\'ve essentially got 3 files with the following headers:
Verify that the CloudFront distribution's Minimum TTL
is set to 0. If it's set to any other value, CloudFront won't respect the no-cache
header and will still cache the file for the Minimum TTL
. More details about the caching directives can be found here:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html
If this doesn't help, try to debug the actual HTTP request for index.html
and post the response headers here so we can have a look at them.
Also, instead of using no-cache
for the index.html file, you can try using
public, must-revalidate, proxy-revalidate, max-age=0
This will allow CloudFront to store the file on the edge location, but it will force it to revalidate it with the origin with each request. If the file hasn't changed, CloudFront will not need to transfer the file's entire content from the origin. This can speed up the response time, especially for larger files.