HTTP Header Overview

Source: Internet
Author: User

If-modified-since,if-node-match,etag,last-modified

1 belongs to Request headers: if-modified-since,if-node-match; belonging to the Response headers: etag,last-modified.

2 explanation If-modified-since

If-modified-since is a standard HTTP request header tag that, when sending an HTTP request, sends the last modification time of the browser-side cache page to the server, which compares the time to the last modification time of the actual file on the server.

If the time is consistent, then return the HTTP status Code 304 (do not return the contents of the file), after the client receives, the local cache file is displayed directly to the browser.

If the time is inconsistent, the HTTP status code 200 and the new file contents are returned, and when the client receives it, it discards the old file, caches the new file, and displays it in the browser.

There are three things to think about:

2.1 First-time visit:
(1) because it is the first time that the page is accessed, the client does not have a if-modified-since tag in the request header when the request is made.
(2) The HTTP status code returned by the server is 200, and the entire contents of the page are sent.
(3) The HTTP header tag returned by the server has last-modified, which tells the client page the last modification time.

2.2 Second Visit

(1) When the client sends an HTTP request, the last modification time of the last file that the server tells it is returned to the server using the if-modified-since tag.
(2) Because the file has not changed, so the server returned the HTTP status code is 304, the content of the page is not sent.

2.3 Modify the file and then make a third visit

(1) When the client sends an HTTP request, the last modification time of the last file that the server tells it is returned to the server using the if-modified-since tag.
(2) The HTTP status code returned by the server is 200 and the entire contents of the new page are sent because the file has been changed and the time is inconsistent on both sides.
(3) The HTTP header tag returned by the server has last-modified, which tells the client page the new last modified time.

Reference

http://blog.csdn.net/kaowen/article/details/5587683

3 Explanation of If-node-match and ETag.

HTTP Header Overview

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.