根据 Firebug,这是第一次检索资源时的响应标头:
Accept-Ranges bytes
Cache-Control public, max-age=86400
Content-Language en
Content-Length 232
Content-Location http://localhost/myapp/cacheTest.html
Content-Type text/html; charset=WINDOWS-1252
Date Wed, 05 Sep 2012 15:59:31 GMT
Last-Modified Tue, 01 May 2012 05:00:00 GMT
Server Restlet-Framework/2.0.3
Vary Accept-Charset, Accept-Encoding, Accept-Language, Accept
我点击离开,然后点击返回,这是发送到服务器的请求标头:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection keep-alive
Host localhost
Referer http://localhost/myapp/cacheTest2.html
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0
因此,服务器自然不能像我想要的那样发送 304,而是再次发送整个资源。
这发生在 Firefox 14 中,我认为这可能是一个错误,所以我升级了。但它仍然在 Firefox 15 中发生。Chrome 没有问题。
我已经尝试过使用和不使用“Expires”标题,这没有区别。Firefox 只是拒绝发送 If-Modified-Since 标头。