Root document index.html hosted on CloudFront stuck in local browser cache

111 views Asked by At

I have a CloudFront distribution with a single origin and behaviour mapped to an S3 bucket. This has been working fine for years. Today I replaced the index.html file and invalidated the distribution for paths /*. After this, fetching https://my.webpage.com/index.html in Chrome gets me the new page, but fetching https://my.webpage.com gets me the old page, but if I do "view source" in Chrome, I see the source of my new index.html. What is going on!?

If I cURL or use Postman to get the file, I get the new version, and I can verify that cache-control is set to nocache;max-age=0 and the ETag was changed when the version was replaced.

However when I go to Chrome and open the URL I still see the old file, with Last-Modified set to 4 weeks ago, and the network tab indicates that the file was returned from the local disk cache.

I tried setting the max TTL to 1 in CloudFront and invalidate again, but with no luck. Whatever I do, it seems Chrome does not even try to see if the file has been changed on the server. What could be causing this? I've rolled out a new version of my web page and I don't want to ask users to do a hard reload!?

0

There are 0 answers