Search code examples
htmlcsspagespeed

Google page speed insights - Leverage browser caching


I am trying to implement the recommendations provided by google in relation to page load insights:

https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2F###########.co.uk&tab=desktop

One of the Should Fix points is:

Leverage browser caching

and it gives a list of resources with the following message:

http://#######.co.uk/css/foundation.css (expiration not specified)

From looking at the documents, it looks to me like what I should do is change the declaration of this file in the header to be as follows:

<link rel="stylesheet" href="/css/foundation.css" max-age="8640000">

But this does not solve the problem, as the same error shows up for this file when I run the report after making the change.

I know the code is in place, as it displays in when I view the source.

I have searched all I can, but cannot see anything that can help me.

I am new to this kind of thing, so do not have much prior knowledge to help me.

Does anyone have any experience with this, any ides how to fix?


Solution

  • I added this code to the web config, which set the cache period to 30 days and solved the problem, as the issue was no longer included in the page speed insight report:

    <staticContent>
                <clientCache cacheControlMaxAge="30.00:00:00" cacheControlMode="UseMaxAge"/>
            </staticContent>