I'm caching requests using Last-modified strategy.
I'm using koa and koa-static and here's part of my code:
app.use((ctx, next) => {
return next().then(() => {
console.log(ctx.fresh)
if (ctx.fresh) {
ctx.status = 304
}
})
})
app.use(staticRoute(path.resolve(__dirname, '../public')))
If contents have not changed, return 304.
However, I open the chrome console and found that some requests' status codes are 200, even if my server's console showing that the ctx.fresh is true.
The single request:
It didn't bring is-modified-sine header.
The interesting thing is, these requests are cached, take a look at their size, all 162B, but their status code are 200 and didn't say they're from disk-cache or memory cache.
Here's the origin size of these requests (when I disabled cache in my koa middleware).



Aucun commentaire:
Enregistrer un commentaire