I receive "Serve static assets with an efficient cache policy" when testing with GTMetrix, why?
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 ETag sent by ShortPixel, which will invalidate the Cache TTL set by ShortPixel. The solution is to figure out a solution with your CDN provider. For Cloudflare you can read more about when ETag is removed here.