每次刷新浏览器网站的静态资源响应的都是200,而没有被浏览器缓存

刷新了多次,所有的静态资源都没有被缓存,请求返回的是200
以下是request 和 response 的header信息,以及NGINX的配置
image.png
Response Header:
`
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Sat, 04 Jan 2020 02:36:43 GMT
Content-Type: text/css
Content-Length: 230254
Last-Modified: Mon, 16 Dec 2019 01:58:05 GMT
Connection: keep-alive
ETag: "5df6e4ad-3836e"
Expires: Mon, 03 Feb 2020 02:36:43 GMT
Cache-Control: max-age=2592000
Accept-Ranges: bytes
`
Request Header:
`
GET /static/css/index.css?v=0ec899553159078aa68c
HTTP/1.1
Host: localhost
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Accept: text/css,*/*;q=0.1
Referer: http://localhost/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7,zh-TW;q=0.6
Cookie: style=background1; PHPSESSID=ta1uqj0g2e3j1recmhm9rurhhi; skin=0
`

NGINX配置:
`
location ~^/(images|javascript|js|css|flash|media|static)/{

    expires 30d;

}

`
请大佬指点迷津

阅读 4k
2 个回答

无标题.png
是不是勾选了disable cache?

Request Header:

...
Cache-Control: no-cache
....

Cache-Control 属性是可以作为请求头或相应头来控制缓存,因为你的请求头设置了 no-cache,所以无强缓存,看看哪里加上了这个请求头,去掉就行

关于浏览器缓存可看这里了解更多

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题