简体   繁体   中英

Amazon Cloudfront not caching certain small number of static objects

Has anyone come across this issue where Amazon Cloudfront seems to refuse to cache a certain small number of static objects?

I've tried invaliding the cache (root path) several times to no avail.

I had a look at the file permissions of the objects in question, and they seemed all ok.

I've also gone into the Amazon Console and there are no errors logged.

You can see more details of this here :

http://www.webpagetest.org/performance_optimization.php?test=171106_A4_be80c122489ae6fabf5e2caadcac8123&run=1#use_of_cdn

My website is using Processwire 3 running Apache and a PW caching product called Procache.

One of your issues is that you are not taking advantage of cache control headers on your objects. This is why you are seeing the message No max-age or expires . Look at this link to learn more about Cache-Control and Expires. Note: You should be using these headers even if you do not use CloudFront as the browser will cache certain objects also.

Using Headers to Control Cache Duration for Individual Objects

You do not indicate what web server that you are using. I have included a link for setting up Apache mod_expires to add cache control headers to your objects.

Apache Module mod_expires

For static assests such as css, js, images, etc. I would setup S3 and serve those objects from S3 via CloudFront. You can control the headers for S3 objects.

The above steps will improve caching of your objects in CloudFront and in the users' browser cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM