Does the ETag header make the Cache-Control header obsolete? How to make sure Cache-Control is not harmful then?

前端 未结 2 1251
花落未央
花落未央 2021-01-22 18:42

Definition of ETag header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag):

The ETag HTTP response header is an identifier for a specific

2条回答
  •  别那么骄傲
    2021-01-22 19:29

    After some research, I found a great tutorial on Medium by Alex Barashkov: "Best practices for cache control settings for your website".

    Alex writes:

    I recommend you apply Cache-Control: no-cache to html files. Applying “no-cache” does not mean that there is no cache at all, it simply tells the browser to validate resources on the server before use it from the cache. That’s why we need to use it with Etag, so browsers will send a simple request and load the extra 80 bytes to verify the state of the file.

提交回复
热议问题