Search code examples
htmlcssyslowload-time

Testing using gtmetrix.com in YSLOW shows far-future expiration error


When I am testing the site using gtmetrix.com in YSLOW, it shows this message. I don't know how to add expire headers.

There are 2 static components without a far-future expiration date.

http://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic,700,700italic,800,800italic http://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900

How can it be solved?


Solution

  • Unfortunately you can't change the cache expiry headers on these external resources, as you're not in control of the server they're hosted on.

    If you want to fix this, you could self-host these webfonts and do a little research on how to set cache headers on them for your type of server (Apache? nginx? Information should be readily available on Google or from your web hosting company if you use one).

    Personally, I recommend taking these sorts of metrics with a pinch of salt. Even gtmetrix.com doesn't score perfectly by their own standards. Their worst score is also for the cache settings of google-hosted services.