Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Thats pretty funny considering google's own pagespeed insights says to do the same thing. You'd think it would compensate. –  Maelish Mar 7 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. –  Mike Hudson Mar 7 at 2:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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