02--http request header and cache knowledge

Source: Internet
Author: User
First, common tools

Under Linux: Curl command, I parameter can view HTTP head information.

Firefox:firebug, Httpfox

Second, common HTTP head information

Third, browser caching mechanism

Using CTRL+F5, you can force the browser to make a request directly to the URL without using cached information. At this point, 2 additional parameters are added to the HTTP head

1. Cache-control Field

Pragma:no-cache and Cache-control:no-cache,cache-control are better supported by browsers and have higher precedence, overriding the meaning of other fields when used with other fields, such as expires.

The list of optional values for the Cache-control field is as follows:

2. Expires field

Usually the format is Tue, 2026 22:46:56 GMT, before the browser initiates the request, the field of the resource is checked before the request is re-initiated to the server if it expires.

3, Last-modified/etag

Represents the last modification time of the resource, which is static (static resources are automatically added last-modified) or dynamic (the servlet provides the Getlastmodified method), which determines whether the resource is up-to-date.

The general server response header returns a last-modified field that tells the browser when the resource was last modified, and when the browser requests it again, the If-modified-since field is added, asking if the cache page is up to date. If not up-to-date, the server returns 304 and does not transmit data.

Four, nginx configuration cache information

Pending additions

02--http request header and cache knowledge

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.