Search code examples
webpagespeedgoogle-pagespeed

Leverage browser caching - I have this enabled but GT Metrix not showing it


I have Leverage browser caching configured on my site via the .htaccess but when I run a performance check on GT Metrix or Google Page Speed - they both say that this is missing and needs to be enabled - any suggestions?

All of the links that it is flagging are external - Google Tag Manager, api.feefo.com, Google tag manager etc.


Solution

  • You cannot control the caching on external links, the domain they are served from sets the cache times.

    If you really want to do it (no business sense in it, but just for trying to get no errors / advisory items) then you can use the method I use:-

    1. use cURL or similar to download the file every 4 hours.

    2. cache that file on your server

    3. serve the local copy of that file so you can control the headers.

    4. Don't forget to set up cache busting on the local copy so that every time you download the latest version from the external host and it is different you can override the cached file.

    As stated, ignore this item if it is only external resources, you have done everything correctly it is just part of the diagnostic tools.