This link has been bookmarked by 284 people . It was first bookmarked on 04 Aug 2006, by Bernard Farrell.
-
23 Oct 15
-
31 Jan 15
-
03 Mar 14
-
09 Feb 14
-
16 Jan 14
-
23 Dec 13
-
Typical HTTP 1.1 response headers might look like this:
-
Cache-Control: max-age=3600, must-revalidate Expires: Fri, 30 Oct 1998 14:19:41 GMT Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT ETag: "3e86-410-3596fbbc"
-
Pragma: no-cache
-
the HTTP specification does not set any guidelines for Pragma response headers
-
Although a few caches may honor this header, the majority won’t, and it won’t have any effect.
-
(last access time
-
last modification time
-
Expiresheaders are especially good for making static images (like navigation bars and buttons) cacheable. -
Because they don’t change much, you can set extremely long expiry time on them
-
if you update a news page once a day at 6am, you can set the representation to expire at that time
-
the time in a HTTP date is Greenwich Mean Time (GMT)
-
limitations
-
the clocks on the Web server and the cache must be synchronised
-
Another problem with
Expiresis that it’s easy to forget that you’ve set some content to expire at a particular time. -
HTTP 1.1 introduced a new class of headers,
Cache-Controlresponse headers -
max-age
-
this directive is relative to the time of the request
-
it only applies to shared (e.g., proxy) caches
-
s-maxage
-
public
-
marks authenticated responses as cacheable
-
private
-
no-cache
-
not to keep a copy of the representation under any conditions
-
no-store -
must-revalidate
-
by specifying this header, you’re telling the cache that you want it to strictly follow your rules
-
When both
Cache-ControlandExpiresare present,Cache-Controltakes precedence. -
The most common validator is the time that the document last changed, as communicated in
Last-Modifiedheader. -
If-Modified-Since
-
HTTP 1.1 introduced a new kind of validator called the ETag.
-
Almost all caches use Last-Modified times as validators
-
Most modern Web servers will generate both
ETagandLast-Modifiedheaders to use as validators for static content (i.e., files) automatically
-
-
19 Dec 13
-
This lets you set aside a section of your computer’s hard disk to store representations that you’ve seen, just for you. The browser cache works according to fairly simple rules. It will check to make sure that the representations are fresh, usually once a session (that is, the once in the current invocation of the browser).
-
-
28 Nov 13
Pali Madra"you a lot of control over how both browser caches and proxies handle your representations. They can’t be seen in the HTML, and are usually automatically generated by the Web server. However, you can control them to some degree, depending on the server you use. In the following sections, you’ll see what HTTP headers are interesting, and how to apply them to your site.
HTTP headers are sent by the server before the HTML, and only seen by the browser and any intermediate caches. Typical HTTP 1.1 response headers might look like this:" -
10 Nov 13
-
08 Nov 13
-
29 Oct 13
-
24 Sep 13
-
02 Sep 13
-
23 Jul 13
khoiril anwar"This is an informational document. Although technical in nature, it attempts to make the concepts involved understandable and applicable in real-world situations. Because of this, some aspects of the material are simplified or omitted, for the sake of clarity. If you are interested in the minutia of the subject, please explore the References and Further Information at the end"
-
07 Jul 13
-
24 Jun 13
-
20 Jun 13
An Be"A Web cache sits between one or more Web servers (also known as origin servers) and a client or many clients, and watches requests come by, saving copies of the responses — like HTML pages, images and files (collectively known as representations) — for itself. Then, if there is another request for the same URL, it can use the response that it has, instead of asking the origin server for it again.
There are two main reasons that Web caches are used:
To reduce latency — Because the request is satisfied from the cache (which is closer to the client) instead of the origin server, it takes less time for it to get the representation and display it. This makes the Web seem more responsive.
To reduce network traffic — Because representations are reused, it reduces the amount of bandwidth used by a client. This saves money if the client is paying for traffic, and keeps their bandwidth requirements lower and more manageable." -
19 Jun 13
-
17 Jun 13
-
05 Jun 13
-
Generate
Content-Lengthresponse headers. It’s easy to do, and it will allow the response of your script to be used in a persistent connection. This allows clients to request multiple representations on one TCP/IP connection, instead of setting up a connection for every request. It makes your site seem much faster. -
If you must know every time a page is accessed, select ONE small item on a page (or the page itself), and make it uncacheable, by giving it a suitable headers. For example, you could refer to a 1x1 transparent uncacheable image from each page. The
Refererheader will contain information about what page called it. -
By default, pages protected with HTTP authentication are considered private; they will not be kept by shared caches. However, you can make authenticated pages public with a Cache-Control: public header; HTTP 1.1-compliant caches will then allow them to be cached.
-
If you want to reload a representation from a specific cache, you can either force a reload (in Firefox, holding down shift while pressing ‘reload’ will do this by issuing a
Pragma: no-cacherequest header) while using the cache.
-
-
01 Jun 13
-
27 May 13
-
13 Apr 13
-
09 Apr 13
-
27 Mar 13
-
26 Mar 13
-
22 Mar 13
-
18 Mar 13
-
13 Mar 13
-
10 Mar 13
-
03 Mar 13
-
18 Feb 13
-
07 Feb 13
-
05 Feb 13
-
18 Jan 13
-
-
recognise
-
unnecessarily
-
-
16 Jan 13
-
04 Jan 13
-
03 Dec 12
-
29 Nov 12
-
The
ExpiresHTTP header is a basic means of controlling caches; it tells all caches how long the associated representation is fresh for. After that time, caches will always check back with the origin server to see if a document is changed.Expiresheaders are supported by practically every cache. -
Most Web servers allow you to set
Expiresresponse headers in a number of ways -
Expiresheaders are especially good for making static images (like navigation bars and buttons) cacheable. -
They’re also useful for controlling caching of a page that is regularly changed
-
The only value valid in an
Expiresheader is a HTTP date
-
-
26 Nov 12
-
16 Nov 12
-
15 Nov 12
-
07 Nov 12
-
31 Oct 12
-
This cache is especially useful when users hit the “back” button or click a link to see a page they’ve just looked at. Also, if you use the same navigation images throughout your site, they’ll be served from browsers’ caches almost instantaneously.
-
How Web Caches Work
-
If the request is authenticated or secure (i.e., HTTPS), it won’t be cached.
-
validate
-
Under certain circumstances — for example, when it’s disconnected from a network — a cache can serve stale responses without checking with the origin server.
-
validator (an
ETagorLast-Modifiedheader) -
it will usually — but not always — be considered uncacheable.
-
Together, freshness and validation are the most important ways that a cache works with content. A fresh representation will be available instantly from the cache, while a validated representation will avoid sending the entire representation over again if it hasn’t changed.
-
server’s configuration
-
true HTTP headers give you a lot of control over how both browser caches and proxies handle your representations. They can’t be seen in the HTML, and are usually automatically generated by the Web server.
-
Expires
-
making static images
-
controlling caching of a page that is regularly changed.
-
Cache-Control
-
max-age
-
Validators and Validation
-
Validators are very important; if one isn’t present, and there isn’t any freshness information (
ExpiresorCache-Control) available, caches will not store a representation at all. -
Last-Modifiedheader -
If-Modified-Sincerequest. -
ETags are unique identifiers that are generated by the server and changed every time the representation does.
-
if the
-
ETag matches when they make a
If-None-Matchrequest, the representation really is the same. -
Most modern Web servers will generate both
ETagandLast-Modifiedheaders to use as validators for static content (i.e., files) automatically; you won’t have to do anything.
-
-
26 Oct 12
-
06 Oct 12
-
05 Oct 12
ken shouferA Web cache sits between one or more Web servers (also known as origin servers) and a client or many clients, and watches requests come by, saving copies of the responses
-
25 Sep 12
-
12 Sep 12
-
10 Sep 12
-
07 Sep 12
-
24 Aug 12
-
20 Aug 12
-
02 Aug 12
-
31 Jul 12
-
19 Jul 12
-
05 Jul 12
-
28 Jun 12
-
If the cache has seen the representation recently, and it was modified relatively long ago.
-
validate
-
-
23 Jun 12
-
16 Jun 12
-
05 Jun 12
-
31 May 12
-
30 May 12
-
29 May 12
-
27 May 12
-
26 May 12
-
25 May 12
-
24 May 12
-
23 May 12
-
jameswanlessThe whats, whys, kinds and whens of caching. A really good tutorial and reference about web caching.
-
22 May 12
-
21 May 12
-
20 May 12
adelgadobThis is an informational document. Although technical in nature, it attempts to make the concepts involved understandable and applicable in real-world situations. Because of this, some aspects of the material are simplified or omitted, for the sake of cla
-
07 Mar 12
Dan LoewenherzThis is an informational document. Although technical in nature, it attempts to make the concepts involved understandable and applicable in real-world situations. Because of this, some aspects of the material are simplified or omitted, for the sake of cla
-
17 Feb 12
-
16 Feb 12
dumbluck2011This is an informational document. Although technical in nature, it attempts to make the concepts involved understandable and applicable in real-world situations. Because of this, some aspects of the material are simplified or omitted, for the sake of cla
-
26 Sep 11
-
19 Sep 11
-
23 Aug 11
-
04 May 11
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.