I have setup a simple static server using express.
var location = path.join(__dirname, 'public');
app.use(express.static(location, { cacheControl: true, setHeaders: function(res, path) {
res.setHeader("Cache-Control","max-age=0,must-revalidate");
} }));
The request header is sent with If-None-Match
and If-Modififed-Since
and I can also see 304 Not Modified
in the response in Chrome if I reload the page without modifying the files. And I get a 200 OK
if I modify one of the files.
But why is my Chrome network tab showing the size of the file downloaded instead of saying (from memory cache)
when the status code is 304 Not Modified
?
I was expecting the files to be loaded from cache if its not modified and served up from the server if modified.
Appreciate any help and guidance.