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