<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kaizou &#187; validation</title>
	<atom:link href="http://www.kaizou.org/tag/validation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kaizou.org</link>
	<description>This is Web 2.71828</description>
	<lastBuildDate>Thu, 24 Nov 2011 09:34:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTTP caching explained</title>
		<link>http://www.kaizou.org/2009/02/http-caching-explained/</link>
		<comments>http://www.kaizou.org/2009/02/http-caching-explained/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 13:08:44 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTTP]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[expiration]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=106</guid>
		<description><![CDATA[Web developers can take advantage of HTTP caching mechanisms to improve significantly the performance and the robustness of their site. HTTP caching mechanisms are however not well-known and often not-well understood. This article aims at clarifying things without going into too much details. For a more complete description of these mechanisms, please refer to the [...]]]></description>
			<content:encoded><![CDATA[<p>Web developers can take advantage of HTTP caching mechanisms to improve significantly the performance and the robustness of their site.</p>
<p>HTTP caching mechanisms are however not well-known and often not-well understood. This article aims at clarifying things without going into too much details.</p>
<p>For a more complete description of these mechanisms, please refer to the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13">HTTP/1.1 RFC</a>.</p>
<p>The HTTP/1.1 protocol includes two basic &#8220;caching&#8221; mechanisms to:</p>
<ul>
<li>eliminate the need to send requests in many cases, using an &#8220;expiration&#8221; mechanism,</li>
<li>eliminate the need to send full responses in many other cases, using a &#8220;validation&#8221; mechanism.</li>
</ul>
<h3>The HTTP/1.1 Expiration model</h3>
<p>The HTTP/1.1 expiration model, as defined in [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2">RFC2616 §13.2</a>], is designed to avoid the client making requests to the origin server until the corresponding content has expired.</p>
<p>The HTTP/1.1 expiration model does not mandate that the origin server explicitly specifies expiration dates for contents. For that reason, each client needs to define its own caching algorithm.</p>
<p>Note: A simple algorithm is provided in [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2">RFC2616 §13.2</a>], based on the last modification date of a document. If that information is provided, then the expiration date equals ten percent of the difference between the reception date and the modification date.</p>
<p>However, deterministic client behaviour is often desirable to avoid server congestion, and two headers can be used to explicitly specify the expiration date of a particular content:<br />
•	Expires (see [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21">RFC2616 §14.21</a>]),<br />
•	Cache-control, max-age directive (see [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">RFC2616 §14.9</a>]).</p>
<p>Note: The Cache-control header always takes precedence over the Expires header</p>
<p>Example:</p>
<p>A page that expires in ten minutes (see how both headers are here redundant)</p>
<pre>HTTP/1.1 200 OK
Date: Mon 06 Oct 2008 12:33:48 GMT
Server: Apache/2.2.8
Cache-Control: max-age=600
Expires: Mon 06 Oct 2008 12:43:48 GMT</pre>
<p>More, the Cache-control header can also be used to further control the cache handling on the client side, by using a set of directives that directly control the client caching algorithm.</p>
<p>Example:</p>
<p>Never cache this page (Expires header will be ignored):</p>
<pre>HTTP/1.1 200 OK
Date: Mon 06 Oct 2008 12:33:48 GMT
Server: Apache/2.2.8
Cache-Control: no-cache
Expires: Mon 06 Oct 2008 12:43:48 GMT</pre>
<p>Always revalidate this page (Expires header will be ignored):</p>
<pre>HTTP/1.1 200 OK
Date: Mon 06 Oct 2008 12:33:48 GMT
Server: Apache/2.2.8
Cache-Control: must-revalidate
Expires: Mon 06 Oct 2008 12:43:48 GMT</pre>
<h3>The HTTP/1.1 Validation model</h3>
<p>The HTTP/1.1 validation model, as defined in [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.3">RFC2616 §13.3</a>], is designed to request the client to verify first if a content has changed before fetching it from the server.</p>
<p>To verify if a stale cache entry is still valid, the client simply inserts specific headers in the request it sends to the origin server, passing back a specific tag it has received in the initial request. If the origin server recognizes that the tag corresponds to a content that hasn&#8217;t changed, it responds with a &#8220;304 Not Modified&#8221;. Otherwise, it sends back the updated document.</p>
<p>Note: Hints that this mechanism is at work can thus be found by looking for &#8220;304 Not Modified&#8221; responses in the web server logs.</p>
<p>The following two headers are typically used to tag a particular content:<br />
•	Last-Modified (see [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29">RFC2616 §14.29</a>]),<br />
•	Etag (see [<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">RFC2616 §14.19</a>]).</p>
<h3>Caching documents retrieved through HTTPS</h3>
<p>By default, most browsers do not cache documents retrieved through HTTPS for security reasons.</p>
<p>However, the origin server can use the Cache-Control header to specify that a specific document is public, and can thus be cached.</p>
<p>Example:</p>
<pre>HTTP/1.1 200 OK
Date: Mon 06 Oct 2008 12:33:48 GMT
Server: Apache/2.2.8
Cache-Control: public
Expires: Mon 06 Oct 2008 12:43:48 GMT</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/02/http-caching-explained/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

