2011-05-15 97 views
3

我注意到chrome緩存了一個視頻文件。我在服務器上另一個替換它和Chrome保持服務從緩存中舊的(使用JW Flash播放器5)必須重新驗證此請求的標頭是否有誤?

請求看起來像這樣的標題:

[email protected]:~$ 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是這樣的:

<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4)$"> 
ExpiresDefault A29030400 
Header append Cache-Control "public, must-revalidate" 
</FilesMatch> 

我拼寫重新驗證錯誤或什麼?

編輯:

爲了讓用例明確:我要的文件被緩存,因爲他們是相當大的,我想節省帶寬。但另一方面,我希望文件得到重新驗證。因此,客戶端執行HEAD請求並檢查內容是否已更改(即etag的用途),並且只在必要時重新提取。

回答

6

你的問題是必須重新驗證只有一次緩存條目不再新鮮,但你已經標記了2900萬秒的緩存響應。 'Cache-Control:max-age = 0,must-revalidate'可能更接近你想要的,如果你想允許緩存但是需要在每次使用時重新驗證。

相關問題