为什么浏览器不缓存我的图片?

5
我正在使用nginx和自适应图片来根据设备分辨率提供动态大小的图像。 由adaptive-images.php文件设置的响应标头如下所示,但每次刷新页面时浏览器都会重新请求图像。 为什么浏览器不缓存这些图像? 浏览器是Google Chrome,无论我如何刷新,它似乎都在请求标头中设置max-age = 0。 我尝试了F5,Ctrl + F5以及在地址栏中输入URL并按Enter键。 请求标头:
GET /img/photos/p8.jpg HTTP/1.1
Host: example.com
Connection: keep-alive
Cache-Control: max-age=0
Accept: image/webp,*/*;q=0.8
Pragma: no-cache
If-Modified-Since: Wed, 16 Jul 2014 12:01:31 GMT
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Referer: http://example.com/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,en-GB;q=0.6

响应头:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Jul 2014 12:08:55 GMT
Content-Type: image/jpeg
Content-Length: 391104
X-Powered-By: PHP/5.4.30
Cache-Control: private, max-age=604800
Expires: Wed, 23 Jul 2014 12:08:55 GMT
Last-Modified: Wed, 16 Jul 2014 12:08:55 GMT
Connection: Keep-Alive
2个回答

2

1
不要在测试时使用控制+Shift+R(重新加载)。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接