码迷,mamicode.com
首页 > 系统相关 > 详细

Why use Cache-Control header in request?

时间:2017-12-22 03:36:15      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:服务   eve   直接   ati   blog   top   turn   force   浏览器   

本地缓存也是缓存代理的一部分。

请求时使用Cache-Control 表示缓存的使用策略。

 

请求头里的no-cache表示浏览器不想读缓存,并不是说没有缓存。一般在浏览器按ctrl+F5强制刷新时,请求头里就有这个no-cache,也就是跳过强缓存和协商缓存阶段,直接请求服务器。(如果直接按F5的话,请求头是max-age=0,只跳过强缓存,但进行协商缓存)
而响应头max-age=259200 ,不太清楚,没验证出来

http://bbs.csdn.net/topics/391022213

 

There may be any number of intermediate proxies between the client and server which do caching. The client can explicitly request explicit caching behaviour from any and all caching entities, things like:

  • max-age - "I don‘t want a response older than X"
  • no-cache - "I want a fresh response"
  • no-transform - "I don‘t want it unless it‘s the original"
  • only-if-cached - "Don‘t bother the origin server if you don‘t have it already"

As with all requests, servers have a certain leeway in whether to honour the request or not. Just because a client insists on an uncached response doesn‘t mean it‘s necessarily going to get it.

 

https://stackoverflow.com/questions/42652931/why-use-cache-control-header-in-request

 

Cache-Control: no-cache is generally used in a request header (sent from web browser to server) to force validation of the resource in the intermediate proxies. If the client doesn‘t send this request to the server, intermediate proxies will return a copy of the content if it is fresh (has not expired according to Expire or max-age fields). Cache-Control directs these proxies to revalidate the copy even if it is fresh.

https://stackoverflow.com/questions/14541077/why-is-cache-control-attribute-sent-in-request-header-client-to-server

Why use Cache-Control header in request?

标签:服务   eve   直接   ati   blog   top   turn   force   浏览器   

原文地址:http://www.cnblogs.com/feng9exe/p/8083004.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!