浏览器无法缓存SWF文件

时间:2009-11-16 20:40:04

标签: apache caching flash

我遇到浏览器没有缓存SWF文件的问题。

我的apache配置中有以下内容:

 ExpiresByType application/x-shockwave-flash "access plus 2 months"

我可以看到从SWF的原始请求返回的标题看起来像这样(过期标题看起来正确设置):

请求:

User-Agent  Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Accept  HTTP Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip,deflate
Cookie  auth_token=

响应:

Server  Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.5 with Suhosin-Patch proxy_html/3.0.0 mod_ssl/2.2.8 OpenSSL/0.9.8g Phusion_Passenger/2.2.5
Last-Modified   Sat, 14 Nov 2009 04:48:19 GMT
Etag    "49384-4784d7c3c8ac0"
Accept-Ranges   bytes
Content-Length  299908
Cache-Control   max-age=5184000
Expires Fri, 15 Jan 2010 20:25:42 GMT
Content-Type    application/x-shockwave-flash

但是,在页面的后续加载中,浏览器仍然发送SWF的If-Range请求,如下所示:

请求:

User-Agent  Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Accept  HTTP Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip,deflate
Cookie   auth_token=
Range   bytes=0-
If-Range    "49384-4784d7c3c8ac0"

响应:

Server  Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.5 with Suhosin-Patch proxy_html/3.0.0 mod_ssl/2.2.8 OpenSSL/0.9.8g Phusion_Passenger/2.2.5
Last-Modified   Sat, 14 Nov 2009 04:48:19 GMT
Etag    "49384-4784d7c3c8ac0"
Accept-Ranges   bytes
Content-Length  299908
Cache-Control   max-age=5184000
Expires Fri, 15 Jan 2010 20:25:45 GMT
Content-Range   bytes 0-299907/299908
Content-Type    application/x-shockwave-flash

这些后续请求似乎是在If-Range标头中发送Etag,并且正在获得包含整个内容的206个响应。我已经尝试设置apache以取消设置Accept-Ranges标头和Etags,但浏览器将在任何一种情况下重新请求该文件。

以前有没有人见过这样的东西,知道如​​何让SWF缓存?

谢谢!

0 个答案:

没有答案