Browser Caching - External JS...

272 views
Skip to first unread message

ke...@healthfulpursuit.com

unread,
Jun 8, 2017, 11:56:51 AM6/8/17
to pagespeed-insights-discuss
Good morning all, 

This is my very first post here!

I've been working on optimizing our site and the Google Site Speed test recommended browser caching, so I did. 

Two issues:

#1. The Google Site Speed tool recommends changing the expiry on external JS files like https://www.googletagmanager.com/gtm.js?id=GTM-MHTQX7 and https://apis.google.com/js/plusone.js -- but I can't change those headers. 

#2. I changed the expiry on JS files and they now show as changed in the headers (Chrome/inspect), but the Google Site Speed tool still doesn't like them. Here is an example:

.../external-referral-links.min.js the headers show: Date:Thu, 08 Jun 2017 15:11:01 GMT  and   Expires:Sat, 08 Jul 2017 15:11:01 GMT   but the Google Site Speed tool lists it as... https://www.###.com/…external-referral-links.min.js?ver=1.0.2 (23.5 hours)

Thoughts?

Kevin

Rick Steinwand

unread,
Jun 9, 2017, 10:14:29 AM6/9/17
to pagespeed-insights-discuss
You can't change what you don't host, but it's still a performance issue.

Why don't you try more than 24 hours? If I remember correctly, it wants more than 24 hours.


ke...@healthfulpursuit.com

unread,
Jun 9, 2017, 10:55:46 AM6/9/17
to pagespeed-insights-discuss
Hi Rick, 

Funny thing is, I've got it set to 1 month, and that's also how the expiry tags show up - in Chrome. 

But, interesting enough, I probably don't entirely understand what I added to my htaccess. 

Kevin


<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

Rick Steinwand

unread,
Jun 12, 2017, 8:55:59 AM6/12/17
to pagespeed-insights-discuss
I'm not versed in Apache. I'll leave that to others. When I checked www.healthfulpursuit.com your cache looked good except for external scripts you load for social media, which you have no control over, unless you choose to host those files from your server.

Maybe go for the low-hanging fruit instead:

Properly formatting and compressing images can save many bytes of data.
Optimize the following images to reduce their size by 606.9KiB (75% reduction).
Message has been deleted

kris....@cashwells.com

unread,
Jun 16, 2017, 9:32:28 AM6/16/17
to pagespeed-insights-discuss
Hello Kevin. The problem in your htaccess file is your "max-age", which is currently set to 84600 (23.5 hours). You can add to that, or like i did, get rid of it.
Reply all
Reply to author
Forward
0 new messages