lukeed / sirv

An optimized middleware & CLI application for serving static files~!
MIT License
1.07k stars 58 forks source link

Should use Cache-Control: no-cache instead of no-store when etag option is true #90

Closed yyx990803 closed 3 years ago

yyx990803 commented 3 years ago

When using

sirv(dir, { dev: true, etag: true })

The etag will be effectively useless because in dev mode the Cache-Control header is set to no-store, which causes Chrome to not include If-None-Match when requesting the file again.

I would suggest using no-cache instead when etag is enabled so that we can leverage 304 even in dev.

lukeed commented 3 years ago

Thanks Evan :) Overlooked that.

lukeed commented 3 years ago

Available in 1.0.10

yyx990803 commented 3 years ago

Thanks that was fast!

lukeed commented 3 years ago

You gave a full explanation – and it was easy 😉