Caching 未缓存资源(304未修改)

Caching 未缓存资源(304未修改),caching,nginx,response,Caching,Nginx,Response,我想得到一个304未修改或200缓存响应,但每次我总是得到一个200 OK响应。我正在使用nginx和firefox开发者检查响应 在响应标题下方: Cache-Control: max-age=315360000, public Connection: keep-alive Content-Disposition: inline; filename="catHuis.jpg" Content-Length: 6640 Content-Type: image/jpeg Date: Mon, 12

我想得到一个304未修改或200缓存响应,但每次我总是得到一个200 OK响应。我正在使用nginx和firefox开发者检查响应

在响应标题下方:

Cache-Control: max-age=315360000, public
Connection: keep-alive
Content-Disposition: inline; filename="catHuis.jpg"
Content-Length: 6640
Content-Type: image/jpeg
Date: Mon, 12 Jan 2015 13:45:33 GMT
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Last-Modified: Mon, 12 Jan 2015 12:40:00 GMT
Pragma: public
Server: nginx/1.2.1
我得到了200个好的头球。很明显,这个日期在未来是非常遥远的,但是我非常绝望,用非常遥远的标题测试了它。有人能给我指一下方向吗?我一定错过了什么

以下是当前的nginx配置:

listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name mydomain.com;
autoindex off;
expires max;
access_log off;
add_header Pragma public;
add_header Cache-Control public;

尝试以下静态资产的位置规则:

location ~* \.(txt|ico|css|js|bmp|jpg|jpeg|gif|png|svg|swf|avi|mp4|webm|pdf|mel|rar|zip|bin)$ {
  expires max;
  access_log off;
  add_header Cache-Control public;
}

恐怕我不能那样做。URL中没有扩展名,因此位置将与这些扩展名中的任何一个都不匹配。。。但必须说,我目前在主配置中(在所有文件上)有这三条规则。我在第一篇文章中添加了我的nginx配置。