Leverage browser caching

I have ran a test on my website and under the Performance Review tab it says Warning for all of my images in “Leverage browser caching of static assets:” even though there is a time of 24 hours. Why is this?

Do you have a link to the results? Generally it will fail if there is no caching but it will warn if it is < 30 days. My guess is that it is warning because of the relatively short cache time which probably means you’re not versioning the resources (changing the actual URL when things change).

I have changed the time to 1 month and its passed the test. Thanks for your help.

I think there is something not quite right about how WPT is checking caching here. The documentation states “An “Expires” header is present (and is not 0 or -1) or a “cache-control: max-age” directive is present and set for an hour or greater. If the expiration is set for less than 30 days you will get a warning (only applies to max-age currently).”

We have a max-age of 7200 for a number of assets, but WPT is complaining about FAILED caching. It it’s getting confused by a potentially incorrect expires header, it shouldn’t be per RFC 7234: Hypertext Transfer Protocol (HTTP/1.1): Caching.

Given this, I would expect to see warnings for everything given that they’re less than 30 days (2 hours in this case), but never a failure (less than 1 hour).

Do you have a link to a test result that I can look at? A failcase will help for debugging the issue.