I receive "Serve static assets with an efficient cache policy" when testing with GTMetrix, why?
Sometimes, while running ShortPixel Adaptive Images or Autoptimize on your website you can notice this issue when running a GTmetrix or a PageSpeed Insights test:
This message, triggered by some URLs from cdn.shortpixel.ai, is completely normal. Here's what you need to know:
- If you see this message, it does not mean that your website is slow. You are just being told that your resources (images, CSS files, JS files...) should be cached in your visitor's browser for more than X days/months (decided by Google).
- The time ShortPixel tells the browser to cache the file is 365 days. That's the "Cache TTL" column seen on the screenshot. If you see something else that is not 365 days, it probably means that a third party is modifying that time (usually your CDN, see next point).
- Sometimes, other CDNs (e.g. Cloudflare) can have settings that will remove the
Etagsent by ShortPixel, which will invalidate the Cache TTL set by ShortPixel. The solution needs to be figured out with your CDN provider. For Cloudflare you can read more about when
Etagis removed here.