Resources that do not specify cache headers
Why is this important?
Fetching something over the network is both slow and expensive. Large responses require many roundtrips between the client and server, which delays when they are available and when the browser can process them, and also incurs data costs for the visitor. Setting a cache header on your server response will tell the browser that it doesn't need to download assets again, which avoids unnecessary requests to the server.
What does the Hint check?
This Hint will trigger for any internal resource URL that does not specify a cache header, or specifies a cache header of less than 3600 seconds (1 hour).
Examples that trigger this Hint:
Resource file URLs that have no cache header, or have a cache header where the 'max age' is less than 3600:
How do you resolve this issue?
The Cache-Control header is the most important header to set as it effectively 'switches on' caching in the browser. With this header in place, and set with a value that enables caching, the browser will cache the file for as long as specified. Without this header the browser will re-request the file on each subsequent request.
Ideally, you should aim to cache as many responses as possible on the client for the longest possible period, and provide validation tokens for each response to enable efficient revalidation.
Follow the decision tree below to determine the optimal caching policy for a particular resource, or a set of resources, that your application uses.