1

Is it possible to set expire by type for remote fonts or Google analytics? I'm getting this report from GTMetrix and everything I've tried isn't working. Suggestions?

There are 4 static components without a far-future expiration date.
http://fonts.googleapis.com/css?family=Open+Sans:300
http://fonts.googleapis.com/css?family=Roboto&subset=latin,latin-ext
http://www.google-analytics.com/ga.js
http://www.google-analytics.com/analytics.js

All of my other expires are working fine. But apparently this type of thing isn't right?

ExpiresByType application/x-font-woff "access 1 year"
ExpiresByType application/font-woff "access 1 year"

What should I do?

0
2

No, you can't change the expiry headers for remote files that aren't under your control.

The only way you could would be to host them on your own server - however you then remove the advantage of these files being hosted on powerful CDNs and the font files are probably already stored in other user's browser caches.

There are work-around methods to use PHP classes to cache remote content by URL that you might want to look into.

2
  • Thats pretty funny considering google's own pagespeed insights says to do the same thing. You'd think it would compensate.
    – Maelish
    Mar 7 '14 at 0:52
  • 1
    There's specific reasons for them not to set long cache times the analytic requests (otherwise they won't record visit data) - i'm not sure why they have short expiry set on fonts though. Mar 7 '14 at 2:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.