HTTP Cache & Proxy

Source: Internet
Author: User

First, the header related to the cache

1. Request

If-modified-since: Last modified time for cached files

If-none-match: The ETag value of the cache file

Cache-control:no-cache Do not use caching

Pragma:no-cache Do not use caching

2, Reaponse

The cache-control:public response is cached and shared by each user

Private cache

No-cache reminding the browser to extract document validation from the server

No-store Absolute Forbidden Cache (for confidential files)

Max-age 60s Cache expiration (relative time)

Date: The current response send time

Expires: Time the cache expires (absolute time)

Last-modified: Last modified time for server-side files

ETag: ETag value for server-side files

3. Why use ETag

The etag is generated by the server side and then sent to the client. Mainly to solve the problem that last-modified cannot solve:

A) Some servers do not accurately obtain the last modification time of the file;

b) Some files are modified very frequently, in the time of the following seconds, last-modified can only be accurate to the second;

c) The last modification time of some files has changed, but the content has not changed, we do not want the client to think that these files have been modified;

Two, several refresh way

For a resource, the browser first accesses, gets the resource content and cache-control:max-age:600,last_modify:wed, and then the browser puts the resource file in the cache.

1, enter the browser URL address bar, carriage return

The browser uses a locally valid cache directly, without sending any requests, and reading directly from the cache. (This condition is called cache hit)

2, F5

The browser will go to the Web server to verify the cache (send a request, take the last_modify:wed, ten weeks GMT), if the server does not modify the file after this time, directly return 304, the browser will go to the cache to obtain resources.

3, Ctrl+f5 (forced refresh)

The browser first deletes the files in the cache and then goes to the server to request a complete and up-to-date resource.

Third, proxy server

1) for the client, the proxy server plays the role of the server, receives request, returns response

2) for the server, the proxy server acts as the client, sends request, returns request

PS: Commonly used grab tools fiddler, HTTP Watch, Charles (blue and white porcelain), Wireshark (shark), etc. can be regarded as a proxy server. The principle of LR is also the proxy

Iv. role of the agency

1) FQ (I'm not going to explain that)

2) anonymous access [to hide the IP address and other details of the original user from the remote server by deleting the identity attribute in the message (client's IP address, cookie, etc.)

3) Internet access via proxy

4) speed up the Internet by proxy caching

5) Child filter (eg: Campus network prohibits minors from visiting adult websites)

Proxy authentication: When a browser accesses an agent that requires authentication, the proxy server returns 407, telling the browser to enter a user name password.

HTTP Cache & Proxy

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.