简体   繁体   English

必须重新验证此请求的标头错误?

[英]Must-revalidate headers of this request wrong?

I noticed that chrome cached a video file. 我注意到chrome缓存了一个视频文件。 I replaced it with another one on the server and chrome kept serving the old one from cache (using JW flash player 5) 我用服务器上的另一个替换它,并且chrome继续从缓存服务旧的(使用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.

I am using mod_headers and mod_expires in apache2 like this: 我在apache2中使用mod_headers和mod_expires,如下所示:

<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? 我拼写重新验证错了什么?

edit: 编辑:

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. 因此,客户端执行HEAD请求并检查内容是否已更改(这就是etag的用途),并且只在必要时才重新提取。

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. 您的问题是必须重新验证只有在缓存条目不再新鲜时才会启动,但您已将响应标记为可缓存2900万秒。 '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. 'Cache-Control:max-age = 0,must-revalidate'可能更接近你想要的,如果你想允许缓存但需要在每次使用时重新验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM