gpt4 book ai didi

http - 没有 'Last-Modified' HTTP header -> 但是缓存?

转载 作者:可可西里 更新时间:2023-11-01 15:15:50 26 4
gpt4 key购买 nike

从浏览器的角度来看,

如果在没有 Last-Modified HTTP header 字段的情况下提供组件(图像、脚本、样式表...)会发生什么情况...

即使将来由于缺少日期/时间信息而无法执行有效性检查 (If-Modified-Since),它是否会被浏览器缓存?

例如:

GET /foo.png HTTP/1.1
Host: example.org
--
200 OK
Content-Type: image/png

...

foo.png 是否被缓存了?

--

您是否知道任何在线服务来提供我可以自己编写的原始 HTTP 响应以测试我的要求?

谢谢。

最佳答案

一般来说,响应可以被缓存,除非他们明确表示他们不能(例如,使用缓存控制:无存储)。

但是,大多数缓存不会存储没有它们可以作为新鲜度基础的东西的响应,例如 Cache-Control、Expires 或 Last-Modified。

完整规则见: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-p6-cache-13#section-2.1

参见: http://www.mnot.net/blog/2009/02/24/unintended_caching举例说明这如何让一些人感到惊讶。

关于http - 没有 'Last-Modified' HTTP header -> 但是缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5477566/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com