I don't understand this feedback. I have already enabled 24 hrs caching for static resources. So why am I seeing the feedback? Is the caching too short?
Headers for one of the affected resources:
Response headers
----------------
Accept-Ranges:bytes
Cache-Control:public, max-age=86400
Connection:keep-alive
Content-Length:2123
Content-Type:image/png
Date:Mon, 20 Apr 2015 23:51:45 GMT
ETag:W/"84b-3727224626"
Last-Modified:Mon, 20 Apr 2015 12:57:43 GMT
Request Headers
---------------
Accept:image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,da;q=0.6
AlexaToolbar-ALX_NS_PH:AlexaToolbar/alxg-3.3
Cache-Control:no-cache
Connection:keep-alive
Cookie:xxxxxxx
DNT:1
Host:xxxxxxxxx
Pragma:no-cache
Referer:http:xxxxxxxxxx
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36
This is how I set the cache in Node.js:
app.use(express.static(path.join(__dirname, '../', config.get('staticContentPath')), {
maxAge: (60 * 60 * 24) * 1000 // 24 hrs x 1000 because Express middleware expects miliseconds and not seconds
}));
I believe your hypothesis is correct.
Here it says:
This rule triggers when PageSpeed Insights detects that the response from your server does not include caching headers or if the resources are specified to be cached for only a short time.
And further down:
We recommend a minimum cache time of one week and preferably up to one year for static assets, or assets that change infrequently. If you need precise control over when resources are invalidated we recommend using a URL fingerprinting or versioning technique - see invalidating and updating cached responses link above.