Chrome Caches for Too Long

后端 未结 3 2141
刺人心
刺人心 2021-01-22 09:39

On my website, www.johnshammas.com, it works perfectly in all browsers. Except...anyone that has viewed the previous version on Chrome is stuck with that version until they empt

3条回答
  •  孤独总比滥情好
    2021-01-22 10:23

    The problem is that Chrome needs to have must-revalidate in the Cache-Control` header in order to re-check files to see if they need to be re-fetched.

    Recommend the following response header:

    Cache-Control: must-validate
    

    This tells Chrome to check with the server, and see if there is a newer file. IF there is a newer file, it will receive it in the response. If not, it will receive a 304 response, and the assurance that the one in the cache is up to date.

    If you do NOT set this header, then in the absence of any other setting that invalidates the file, Chrome will never check with the server to see if there is a newer version.

    Here is a blog post that discusses the issue further.

提交回复
热议问题