`cache-control: max-age=0` in http request

后端 未结 2 1708
灰色年华
灰色年华 2021-01-27 02:08

I have one question: suppose in each http request there is a cache-control: max-age=0 header, so each request will go all the way to the origin web server. Does it

2条回答
  •  面向向阳花
    2021-01-27 02:48

    from other post: When sent by the user agent

    I believe shahkalpesh's answer applies to the user agent side. You can also look at 13.2.6 Disambiguating Multiple Responses.

    If a user agent sends a request with Cache-Control: max-age=0 (aka. "end-to-end revalidation"), then each cache along the way will revalidate its cache entry (eg. with the If-Not-Modified header) all the way to the origin server. If the reply is then 304 (Not Modified), the cached entity can be used.

    On the other hand, sending a request with Cache-Control: no-cache (aka. "end-to-end reload") doesn't revalidate and the server MUST NOT use a cached copy when responding.

    It makes sense and match my result. when cache is not expired in chrome,it will send request to CDN,CDN will query this with if-modified-since with origin ,then serve the end user.

提交回复
热议问题