Cloudfront cachea web de s3

1

I have a static web in an AWS bucket s3, linked to cloudfront.

The problem is that when modifying the index.html and the folders of css and js, when refreshing does not load the new content, the old one appears.

I tried to put the TTL to 0, to change the url in the cloudfront and nothing.

Entering through the url that gives S3 everything works ok, but with domain no.

This is the configuration: CNAME : xxx.cloudfront.net

point A : ALIAS xxx.cloudfront.net.

Any advice? Greetings

    
asked by Pablo Cegarra 09.03.2017 в 20:42
source

1 answer

1

Although that is the expected behavior of CloudFront, you have two options.

Invalidations

If you need to remove an object from the cache before it expires, you can invalidate it , so when a client requests that object, it will be called from bucket S3.

You can invalidate an object, an object type ( *.jpg ) or a directory ( imágenes/* ). To do this you have to go to your CloudFront distribution where you will see the Invalidations tab and the button to create them. [

The dialog box that appears is explained by itself:

Versionado

You can create an object in your bucket and add a distinctive feature to the name. The most common is a timestamp :

imagen-201703091756.jpg

This way when you request that version, CloudFront will call from the bucket.

The advantage of this option is that you can do programmatically with the language of your choice.

  

In the Amazon documentation you will find more information.

PD. I've removed the because it's not relevant to your question .

    
answered by 10.03.2017 / 00:59
source