Request Header: The browser sends the requested data, resources, to the server. Response header: The server responds to the browser data and tells the browser who I am and what I want you to do. For example, I am nginx, give you the resources is correct 200 or the wrong 404, I want you to cache how long.
Common request headers: accept:text/html,image/* &NB Sp Browsers can receive types accept-charset:iso-8859-1 &NB Sp   ; Browser can receive encoding type accept-encoding:gzip,compress Browser can receive compression encoding type ACCEPT-LANGUAGE:EN-US,ZH-CN &NBS P The browser can receive language and country type Host : www.lks.cn:80 &NB Sp browser-requested host and Port If-modified-since:tue, Jul 2000 18:23:51 GMT A page cache time referer:http://www.lks.cn/index.html &NBS P request from which page user-agent:mozilla/4.0 compatible; MSIE 5.5; Windows NT 5.0 Browser-related information cookies: &NBS P information sent by the browser staging server connection:close1.0/keep-alive1.1 &NBS P http request version features date:tue, Jul 18:23:51gmt request website time allow:get & nbsp , &NB Sp &NBSP request Method GET Common also post keep-alive:5 & nbsp &NBS P 5 time of connection; connection:keep-alive &NB Sp Long connections cache-control:max-age=300 &NBSP ; Cache maximum Time 300s
Common response headers: location:http://www.lks.cn/index.html &NBS P control which page the browser displays Server:apache nginx & nbsp &NBSP ; Server types content-encoding:gzip &NBS P Server-sent compression encoding content-length:80 / server sends the displayed bytecode length Degrees CONTENT-LANGUAGE:ZH-CN and nbsp   Server-sent content language and country name Content-type:image/jpeg; Charset=utf-8 Server send content Type and encoding type Last-modified:tue, 18:23:51gmt Server last modified time REFRESH:1;URL=HTTP://WW w.lks.cn nbsp Control browser 1 seconds after the forwarding URL points to the page content-disposition:attachment; Filename=lks.jpg server control browser send download open file transfer-encoding:chunked & nbsp Server block transfer Handing data to clients SET-COOKIE:SS=Q0=5LB_NQ; Path=/search servers send cookie-related information Expires:-1 &NBSP ; &NBSp &NBS P resource expiration time, available to browser cache data, 1 expire forever CACHE-CONTROL:NO-CA Che & nbsp Tell the browser that the server checksum must be back, regardless of whether or not the data is cached. Pragma:no-cache and nbsp server control browser do not cache Web connection:close/keep-alivehttp  &NBS p; requested version features Date:tue, Jul 18:23:51 GMT & nbsp respond to website time ETag: "IHFDGKDGNP98HDFG" Resource entity identification (unique identifier, similar to MD5 value, file modified MD5 not the same)
Explanations about Cache-related headers:
ExpiresA GMT time that attempts to tell the browser that a copy of the corresponding cache can be trusted and used within this date, with the disadvantage that one but the client date is inaccurate. It may cause invalidation.
Pragma:no-cacheThis is the regular head in http1.0, acting with http1.1 Cache-control:no-cache
last-modifiedA GMT time that tells the last modification time of the requested entity. Used by the browser to verify that its cached copy is still trusted. Two conditional request headers associated with it: 1) if-modified-since is only meaningful in the Get method, which is also more common. If the entity returns a 304 after the specified time without modification, otherwise returns a regular GET request response (such as 200), the static file is not modified to return 304 is good, because it is just back to the server to check if there is a modification, and does not have to re-request data like 200. 2) If-unmodified-since: If the entity does not have any modifications, the request can be executed directly, and if there is a modification, a 412 precondition failed status code is returned, and the behavior action corresponding to the method is discarded (except for the Get method).
Cache-control(Common head of http1.1) 1) public only the response header now notifies the browser that it can unconditionally cache the response. 2) Private body is now the response header, notifying the browser to cache responses only for individual users. You can specify a field specifically. such as private– "username" 3) No-cache a) in the request header: Tell the browser to go back to the server to fetch the data and verify your cache (if any). b) in the response header: Tell the browser, be sure to back the server checksum, regardless of the cache data. If it is determined that it has not been changed, you can use the data in the cache 4) No-store tell the browser not to be cached under any circumstances. 5) Max-age a) in the request header: Force the response to the browser, based on that value, check the cache. That is, the age value with itself, compared to the request time. If the max-age value is exceeded, the server-side validation is enforced. To ensure that a fresh response is returned. Its function is essentially with the traditional Expir ES is similar, but the difference is that ex Pires is compared against a particular date value. One but the time of the cache itself is inaccurate. The result may be wrong. And Max-age, obviously, is not the problem. The priority of Max-age is also higher than expires. b) in the response header: Ibid.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.