必重新验证这一请求错头? [英] Must-revalidate headers of this request wrong?
问题描述
我注意到,铬缓存的视频文件。我在服务器上另一个替换了它和Chrome保持服务从缓存中旧的(使用JW Flash播放器5)
I noticed that chrome cached a video file. I replaced it with another one on the server and chrome kept serving the old one from cache (using JW flash player 5)
请求看起来像这样的标题:
The headers of the request look like this:
joe@joe-desktop:~$ wget -O - -S --spider http://www.2xfun.de/files_geheimhihi14/20759.mp4
Spider mode enabled. Check if remote file exists.
--2011-05-15 22:40:56-- http://www.2xfun.de/files_geheimhihi14/20759.mp4
Resolving www.2xfun.de... 213.239.214.112
Connecting to www.2xfun.de|213.239.214.112|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Sun, 15 May 2011 20:40:56 GMT
Server: Apache
Last-Modified: Sun, 15 May 2011 20:37:59 GMT
ETag: "89b38-3bb227-4a35683b477c0"
Accept-Ranges: bytes
Content-Length: 3912231
Cache-Control: max-age=29030400, public, must-revalidate
Expires: Sun, 15 Apr 2012 20:40:56 GMT
Connection: close
Content-Type: video/mp4
Length: 3912231 (3.7M) [video/mp4]
Remote file exists.
我使用mod_headers中,并指定mod_expires在Apache2的是这样的:
I am using mod_headers and mod_expires in apache2 like this:
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4)$">
ExpiresDefault A29030400
Header append Cache-Control "public, must-revalidate"
</FilesMatch>
我有没有拼写错误重新验证什么?
Did I spell revalidate wrong or something?
编辑:
为了让用例明确:我要的文件被缓存,因为他们是相当大的,我想节省带宽。但在另一方面,我要的文件被重新验证。因此,客户端执行HEAD请求,并检查内容是否已经改变(多数民众赞成在ETAG是什么),只有重新获取,如果必要的。
To make the use case clear: I want the files to be cached, because they are rather big and I want to save bandwidth. But on the other hand I want the files to be re-validated. So the client does a HEAD request and checks whether the content has changed (thats what the etag is for), and only re-fetches if necessary.
推荐答案
您的问题是必须 - 重新验证只踢一次缓存条目已经不再新鲜,但你标记的响应作为缓存为29000000秒。 缓存控制:最大年龄= 0,必重新验证可能更接近你想要什么,如果你想允许缓存,但需要在每次使用重新验证。
Your problem is that must-revalidate only kicks in once a cache entry is no longer fresh, but you've marked the response as cacheable for 29 million seconds. 'Cache-Control: max-age=0, must-revalidate' may be closer to what you want, if you want to allow caching but require revalidation on each use.
这篇关于必重新验证这一请求错头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!