即使没有 cache-control header 也会缓存响应吗?
Do responses get cached even if there is no cache-control header?
我想了解为什么即使响应中没有返回 cache-control
header 也会缓存此资源。
这个资源怎么可能被缓存了?
这在 Section 4.2.2 of RFC 7234 中得到解决:
Since origin servers do not always provide explicit expiration times,
a cache MAY assign a heuristic expiration time when an explicit time
is not specified, employing algorithms that use other header field
values (such as the Last-Modified
time) to estimate a plausible
expiration time.
事实上,浏览器会这样做。
我想了解为什么即使响应中没有返回 cache-control
header 也会缓存此资源。
这个资源怎么可能被缓存了?
这在 Section 4.2.2 of RFC 7234 中得到解决:
Since origin servers do not always provide explicit expiration times, a cache MAY assign a heuristic expiration time when an explicit time is not specified, employing algorithms that use other header field values (such as the
Last-Modified
time) to estimate a plausible expiration time.
事实上,浏览器会这样做。