Chrome browser is not sending if-modified-since header to server

前端 未结 6 1624
一整个雨季
一整个雨季 2020-12-09 14:45

I have these headers being sent to the client by the server:

Cache-Control:private
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html
Date:Su         


        
6条回答
  •  借酒劲吻你
    2020-12-09 15:05

    Browsers have a lot of counter intuitive behavior when it comes to caching. You would expect, that if the response includes a last-modified-date, that the browser would revalidate this before reusing it. But none of the major browsers actually do that.

    The ideal settings for your situation depend on when you want the browser to revalidate, see link below.

    Not only do browsers act counter intuitively, different browsers also behave differently in the same situation. For example when the user clicks on the refresh button.

    You can read how the different browsers (Internet Explorer, Edge, Safari, FireFox, Chrome) behave with different caching directives (Etag, last-modified, must-revalidate, expires, max-age, no-cache, no-store) at https://gertjans.home.xs4all.nl/javascript/cache-control.html

提交回复
热议问题