Mobile app version of vmapp.org
Login or Join
Connie744

: Can external resources be cached for 7 days to improve my PageSpeed score? Google Pagespeed recommends caching resources for at least a week under "Leverage browser caching". I've done it for

@Connie744

Posted in: #Cache #GooglePagespeed

Google Pagespeed recommends caching resources for at least a week under "Leverage browser caching". I've done it for internal files but I was wondering if something could malfunction if I did the same to social media files:

connect.facebook.net/en_US/all.js (20 minutes) platform.twitter.com/widgets.js (30 minutes) apis.google.com/js/api.js (30 minutes) apis.google.com/js/plusone.js (30 minutes) www.gstatic.com/swiffy/v7.1.1/runtime.js (50 minutes) pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 minutes) pagead2.googlesyndication.com/pagead/osd.js (60 minutes) oauth.googleusercontent.com/…e:rpc:shindig.random:shindig.sha1.js?c=2 (60 minutes) stats.g.doubleclick.net/dc.js (2 hours)


The numbers in parenthesis indicate current expiration time.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Connie744

2 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

You can only control the caching of files from your own domain. Facebook, Google, and DoubleClick serve those files. If your server isn't the one that sends the files to users, you have no control over their caching. Facebook, Google, and DoubleClick have thought about caching times and have set them appropriately.

The page speed recommendations are just that: recommendations. They are not hard and fast rules. There are times that you want to break the rules. In this case, these third party providers don't allow those files to be cached very long for freshness.

If you want a perfect page speed score, you would have to stop using these third party services.

10% popularity Vote Up Vote Down


 

@Vandalay111

Yes, sure, something could malfunction, though probably it would be to hard to notice this unless you cache it for thousands of clients.

The cache expire time is set by every site for reason, according to their update deployment practices. If you override this, beware of malfunction.

Also, overriding cache expire time by any intermediate cache/proxy is a violation of HTTP standards (RFC7234 Section 4.2.4. Serving Stale Responses).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme