Home  >  Article  >  Backend Development  >  Http请求头和响应头的Cache-Control如何理解

Http请求头和响应头的Cache-Control如何理解

WBOY
WBOYOriginal
2016-06-13 12:18:301586browse

Http请求头和响应头的Cache-Control怎么理解
网站是wordpress,请求头里的Cache-Control是no-cache,响应头里的是我在nginx里设置的max-age=259200,那么浏览器到底缓存了没有。。。

<br />Request Headersview source<br />Accept:*/*<br />Accept-Encoding:gzip, deflate, sdch<br />Accept-Language:zh-CN,zh;q=0.8<br />Cache-Control:no-cache<br />Connection:keep-alive<br />Cookie:CNZZDATA1254790698=1245005062-1429681029-%7C1429681029<br />Host:yuanzi.me<br />Pragma:no-cache<br />Referer:http://yuanzi.me/<br />User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36<br /><br />Response Headersview source<br />Accept-Ranges:bytes<br />Cache-Control:max-age=259200<br />Connection:keep-alive<br />Content-Length:100922<br />Content-Type:application/javascript<br />Date:Wed, 22 Apr 2015 06:13:34 GMT<br />ETag:"55371597-18a3a"<br />Expires:Sat, 25 Apr 2015 06:13:34 GMT<br />Last-Modified:Wed, 22 Apr 2015 03:29:27 GMT<br />Server:nginx/1.6.2<br />

------解决思路----------------------
如果响应头中有 Cache-Control=no-cache 那么浏览器是不会缓存的
但你的响应头并没有,所以应该是有缓存的。
不过即使有缓存,也不一定被浏览器使用。因为浏览器还有其他设置
同时并不是与缓存相关的头都会被浏览器接受,协议只是建议,并不一个定非要执行

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn