Http1.1 Protocol

Source: Internet
Author: User

Response Headers Response Header

Expires sets the response content expiration time

The attribute value of the expiration time header information can only be the date time in the HTTP format, and the HTTP date time must be GMT instead of the local time. Example:

Expires: Fri, 30 Oct 1998 14:19:41 "Eee, DD Mmm yyyy hh: mm: ss z", locale. US );

Httpdateformat = new simpledateformat ("Eee, DD Mmm yyyy hh: mm: ss z", locale. US );
Httpdateformat. settimezone (timezone. gettimezone ("GMT "));

Or use response. adddateheader ("expires", new date (). gettime () + 15*1000 );

If it is set to 0, it indicates that it has expired. If you need to set it to never expire, set it to a year (60*60*24*365 * 1000l). Note that it cannot exceed one year, this is described in the http1.1 protocol.

In addition, if the response contains the cache-control Max-age setting, the expires value will be overwritten.

Test results: the first request will certainly be sent to the server, because the browser does not cache, the following example is the second request.

1. open a new window (_ blank)

Do not access the server

2. Press enter in the address bar.

Do not access the server

3. Press the button to return

No server access

4. Press refresh button = (F5)

Will access the server

 

Cache-control: sets the browser's cache command for the response content

No-Cache does not use Cache

Before the max-age expires, the browser will not send a request to the server (Press enter in the address bar and press back), but how to refresh the browser F5 will send a request each time.

Http://www.ggseo.cn/blog/post/cache-control.html

Http://www.path8.net/tn/archives/2745

 

Http1.1 Protocol

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.