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

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

本文介绍了必须重新验证此请求的标头错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我注意到 chrome 缓存了一个视频文件.我用服务器上的另一个替换它,chrome 继续从缓存中提供旧的(使用 JW flash player 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)

请求的标头如下所示:

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.

我在 apache2 中像这样使用 mod_headers 和 mod_expires:

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>

我是否拼写 revalidate 错误或什么?

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.

推荐答案

您的问题是 must-revalidate 仅在缓存条目不再新鲜时启动,但您已将响应标记为可缓存 2900 万秒.'Cache-Control: max-age=0, must-revalidate' 可能更接近你想要的,如果你想允许缓存但每次使用都需要重新验证.

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.

这篇关于必须重新验证此请求的标头错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:29