我如何知道代理服务器是否缓存了我网站上的图像?
以下是我们公司网站上的图像的 http 响应标头。
HTTP/1.1 200 OK
Content-Type: image/png
Last-Modified: Thu, 03 Dec 2009 15:51:57 GMT
Accept-Ranges: bytes
ETag: "1e61e38a3074ca1:0"
Date: Wed, 06 Jan 2010 22:06:23 GMT
Content-Length: 9140
无论如何,有没有办法知道该图像是否可以在某些代理服务器中公开缓存? RFC 定义似乎不明确 http://www.w3 .org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1 和 http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4。
The following is a http response header from a image on our company's website.
HTTP/1.1 200 OK
Content-Type: image/png
Last-Modified: Thu, 03 Dec 2009 15:51:57 GMT
Accept-Ranges: bytes
ETag: "1e61e38a3074ca1:0"
Date: Wed, 06 Jan 2010 22:06:23 GMT
Content-Length: 9140
Is there anyway to know if this image is publicly cacheable in some proxy server? The RFC definition seems to be ambiguous http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1 and http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在您的网址上运行 RED,它会告诉您响应是否可缓存以及其他信息。
Run RED on your URL and it'll tell you whether the response is cacheable, among other information.
您显示的标头似乎是可缓存的。
如果您想控制正确配置的代理和 Web 浏览器的缓存行为,您可以研究使用 Cache-Control 和 Expires 标头来获得额外的控制。
这是我添加书签的一个网页,其中有一个人对如何解释您列出的规范(以及其他一些规范)的看法:
http://www.web-caching.com/mnot_tutorial/how.html
如果您需要保证某人每次都能看到全新的图像(即使您和他们之间的设备配置错误),您可能需要考虑使用随机或 GUID 值作为 URL 的一部分。
The headers you show appear to be cacheable.
If you would like to control the caching behavior of correctly configured proxies and web browsers, you might investigate using the Cache-Control and Expires headers to gain additional control.
Here is a webpage I had bookmarked that has one person's opinion of how to intepret the specifications you list (plus some other ones):
http://www.web-caching.com/mnot_tutorial/how.html
If you need to guarantee that someone sees a completely new image each time (even with misconfigured devices between you and them), you may want to consider using a randomized or GUID value as part of the URL.
此处是有关设置代理缓存标头的教程。请务必阅读有关设置 cookie 的部分!
Here is a tutorial on setting headers for proxy caching. Be sure to read the part about setting cookies!