HTTP cache Headers last-modified and ETag introduce _win servers

Source: Internet
Author: User
Tags iis ranges webp

First time request

Request:

Copy Code code as follows:

Get/pic/201408/102.jpg http/1.1
Host:www.jb51.net
Connection:keep-alive
Cache-control:no-cache
accept:image/webp,*/*;q=0.8
Pragma:no-cache
user-agent:mozilla/5.0 (Windows NT 6.1) applewebkit/537.36 (khtml, like Gecko) chrome/29.0.1547.66 safari/537.36
referer:http://www.jb51.net/
Accept-encoding:gzip,deflate,sdch
accept-language:zh-cn,zh;q=0.8

Response:

Copy Code code as follows:

http/1.1 OK
content-length:66529
Content-type:image/jpeg
Last-modified:tue, Aug 2014 12:23:54 GMT
Accept-ranges:bytes
ETag: "029e570a8bbcf1:1ae2"
server:microsoft-iis/6.0
X-powered-by:asp.net
Date:wed, Aug 2014 00:29:03 GMT

Xxx

Second request

Request:

Copy Code code as follows:

Get/pic/201408/102.jpg http/1.1
Host:www.jb51.net
Connection:keep-alive
Cache-control:max-age=0
accept:image/webp,*/*;q=0.8
Pragma:no-cache
If-modified-since:tue, Aug 2014 12:23:54 GMT
user-agent:mozilla/5.0 (Windows NT 6.1) applewebkit/537.36 (khtml, like Gecko) chrome/29.0.1547.66 safari/537.36
If-none-match: "029e570a8bbcf1:1ae2"
referer:http://www.jb51.net/
Accept-encoding:gzip,deflate,sdch
accept-language:zh-cn,zh;q=0.8

Response:

Copy Code code as follows:

http/1.1 304 Not Modified
Last-modified:tue, Aug 2014 12:23:54 GMT
Accept-ranges:bytes
ETag: "029e570a8bbcf1:1ae2"
server:microsoft-iis/6.0
X-powered-by:asp.net
Date:wed, Aug 2014 00:29:54 GMT

HTTP caching is to save the amount of data transmitted by the network, and the server-side resources are returned 304 and the content is empty when the resource does not change. Both last-modified and ETag are used for HTTP caching, which is passed back to the server by the browser on the second request to determine if the resource has changed. ETag is introduced by the http/1.1 standard, it is a supplement to last-modified, the main reasons are as follows:

• Some periodically modified files, change the time changed but the content does not change, at this time do not want to get a back;
• Some file changes are very frequent, such as 1 seconds modified several times, last-modified can only be accurate to the second;
• Some servers cannot get the exact time of file modification;

Description: The http/1.1 standard does not stipulate etag content is what or how to achieve, the only stipulation is etag need to put in quotation marks.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.