181e56d8b348d301d615ccf5465ae600fee2867berikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive This file is generated from xml source: DO NOT EDIT
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>Content Negotiation - Apache HTTP Server Version 2.5</title>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<script src="/style/scripts/prettify.min.js" type="text/javascript">
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<link href="/images/favicon.ico" rel="shortcut icon" /></head>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.5</a></div><div id="page-content"><div id="preamble"><h1>Content Negotiation</h1>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<p><span>Available Languages: </span><a href="/en/content-negotiation.html" title="English"> en </a> |
ee649f9236fe7fcf255bbfa11f2cce080f996521sf<a href="/fr/content-negotiation.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<a href="/ja/content-negotiation.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd<a href="/ko/content-negotiation.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/tr/content-negotiation.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
c68aa7f213d409d464eaa6b963afb28678548f4frbowen <p>Apache HTTPD supports content negotiation as described in
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen representation of a resource based on the browser-supplied
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen preferences for media type, languages, character set and
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive encoding. It also implements a couple of features to give
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive more intelligent handling of requests from browsers that send
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen incomplete negotiation information.</p>
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p>Content negotiation is provided by the
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <code class="module"><a href="/mod/mod_negotiation.html">mod_negotiation</a></code> module, which is compiled in
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl by default.</p>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#about">About Content Negotiation</a></li>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen<li><img alt="" src="/images/down.gif" /> <a href="#negotiation">Negotiation in httpd</a></li>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<li><img alt="" src="/images/down.gif" /> <a href="#methods">The Negotiation Methods</a></li>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<li><img alt="" src="/images/down.gif" /> <a href="#better">Fiddling with Quality
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<li><img alt="" src="/images/down.gif" /> <a href="#extensions">Extensions to Transparent Content
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<li><img alt="" src="/images/down.gif" /> <a href="#naming">Note on hyperlinks and naming conventions</a></li>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<li><img alt="" src="/images/down.gif" /> <a href="#caching">Note on Caching</a></li>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="about" id="about">About Content Negotiation</a></h2>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>A resource may be available in several different
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen representations. For example, it might be available in
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen different languages or different media types, or a combination.
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen One way of selecting the most appropriate choice is to give the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen user an index page, and let them select. However it is often
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen possible for the server to choose automatically. This works
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl because browsers can send, as part of each request, information
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen about what representations they prefer. For example, a browser
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen could indicate that it would like to see information in French,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen if possible, else English will do. Browsers indicate their
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen preferences by headers in the request. To request only French
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen representations, the browser would send</p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele<div class="example"><p><code>Accept-Language: fr</code></p></div>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>Note that this preference will only be applied when there is
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen a choice of representations and they vary by language.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>As an example of a more complex request, this browser has
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen been configured to accept French and English, but prefer
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen French, and to accept various media types, preferring HTML over
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen plain text or other text types, and preferring GIF or JPEG over
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen other media types, but also allowing any other media type as a
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen last resort:</p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele Accept-Language: fr; q=1.0, en; q=0.5<br />
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen <p>httpd supports 'server driven' content negotiation, as
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen defined in the HTTP/1.1 specification. It fully supports the
198c35e2b8696f42f3b2a4130f2ae1225b26d2c6humbedooh <code>Accept-Charset</code> and <code>Accept-Encoding</code>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen request headers. httpd also supports 'transparent'
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen content negotiation, which is an experimental negotiation
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen protocol defined in RFC 2295 and RFC 2296. It does not offer
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl support for 'feature negotiation' as defined in these RFCs.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>A <strong>resource</strong> is a conceptual entity
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen identified by a URI (RFC 2396). An HTTP server like Apache HTTP Server
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen provides access to <strong>representations</strong> of the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen resource(s) within its namespace, with each representation in
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the form of a sequence of bytes with a defined media type,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen character set, encoding, etc. Each resource may be associated
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen with zero, one, or more than one representation at any given
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen time. If multiple representations are available, the resource
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen is referred to as <strong>negotiable</strong> and each of its
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen representations is termed a <strong>variant</strong>. The ways
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen in which the variants for a negotiable resource vary are called
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen<h2><a name="negotiation" id="negotiation">Negotiation in httpd</a></h2>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>In order to negotiate a resource, the server needs to be
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen given information about each of the variants. This is done in
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen one of two ways:</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Using a type map (<em>i.e.</em>, a <code>*.var</code>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen file) which names the files containing the variants
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen explicitly, or</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Using a 'MultiViews' search, where the server does an
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen implicit filename pattern match and chooses from among the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen results.</li>
181e56d8b348d301d615ccf5465ae600fee2867berikabele <h3><a name="type-map" id="type-map">Using a type-map file</a></h3>
20189240503ef2c8f5dc6e2248b57faab4b23b5and <p>A type map is a document which is associated with the handler
20189240503ef2c8f5dc6e2248b57faab4b23b5and named <code>type-map</code> (or, for backwards-compatibility with
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen older httpd configurations, the <a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME-type</a>
20189240503ef2c8f5dc6e2248b57faab4b23b5and <code>application/x-type-map</code>). Note that to use this
20189240503ef2c8f5dc6e2248b57faab4b23b5and feature, you must have a handler set in the configuration that
20189240503ef2c8f5dc6e2248b57faab4b23b5and defines a file suffix as <code>type-map</code>; this is best done
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar <pre class="prettyprint lang-config">AddHandler type-map .var</pre>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>Type map files should have the same name as the resource
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen which they are describing, followed by the extension
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen <code>.var</code>. In the examples shown below, the resource is
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen named <code>foo</code>, so the type map file is named
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen <p>This file should have an entry for each available
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variant; these entries consist of contiguous HTTP-format header
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen lines. Entries for different variants are separated by blank
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen lines. Blank lines are illegal within an entry. It is
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen conventional to begin a map file with an entry for the combined
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen entity as a whole (although this is not required, and if
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen present will be ignored). An example map file is shown below.</p>
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen <p>URIs in this file are relative to the location of the type map
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen file. Usually, these files will be located in the same directory as
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen the type map file, but this is not required. You may provide
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen absolute or relative URIs for any file located on the same server as
b9f7b2acbe4a228c3eaeb6293554ca9488330c83rbowen the map file.</p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele URI: foo<br />
181e56d8b348d301d615ccf5465ae600fee2867berikabele Content-language: en<br />
181e56d8b348d301d615ccf5465ae600fee2867berikabele Content-language: fr, de<br />
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p>Note also that a typemap file will take precedence over the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen filename's extension, even when Multiviews is on. If the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variants have different source qualities, that may be indicated
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen by the "qs" parameter to the media type, as in this picture
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl (available as JPEG, GIF, or ASCII-art): </p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele URI: foo<br />
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>qs values can vary in the range 0.000 to 1.000. Note that
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen any variant with a qs value of 0.000 will never be chosen.
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen Variants with no 'qs' parameter value are given a qs factor of
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen 1.0. The qs parameter indicates the relative 'quality' of this
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variant compared to the other available variants, independent
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl of the client's capabilities. For example, a JPEG file is
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl usually of higher source quality than an ASCII file if it is
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen attempting to represent a photograph. However, if the resource
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl being represented is an original ASCII art, then an ASCII
2684d5de7d8996ac96df3a37e8f8a49c502f26dfjsl representation would have a higher source quality than a JPEG
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen representation. A qs value is therefore specific to a given
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variant depending on the nature of the resource it
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen represents.</p>
f6066dc0a6ad0432b74774e290c04c3cc4aa2dafrbowen <p>The full list of headers recognized is available in the <a href="mod/mod_negotiation.html#typemaps">mod_negotiation
181e56d8b348d301d615ccf5465ae600fee2867berikabele<h3><a name="multiviews" id="multiviews">Multiviews</a></h3>
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p><code>MultiViews</code> is a per-directory option, meaning it
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim can be set with an <code class="directive"><a href="/mod/core.html#options">Options</a></code>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim directive within a <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code>, <code class="directive"><a href="/mod/core.html#location"><Location></a></code> or <code class="directive"><a href="/mod/core.html#files"><Files></a></code> section in
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <code>httpd.conf</code>, or (if <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code> is properly set) in
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <code>.htaccess</code> files. Note that <code>Options All</code>
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive does not set <code>MultiViews</code>; you have to ask for it by
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>The effect of <code>MultiViews</code> is as follows: if the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen server receives a request for <code>/some/dir/foo</code>, if
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <code>/some/dir</code> has <code>MultiViews</code> enabled, and
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <code>/some/dir/foo</code> does <em>not</em> exist, then the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen server reads the directory looking for files named foo.*, and
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen effectively fakes up a type map which names all those files,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen assigning them the same media types and content-encodings it
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen would have if the client had asked for one of them by name. It
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen then chooses the best match to the client's requirements.</p>
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p><code>MultiViews</code> may also apply to searches for the file
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim named by the <code class="directive"><a href="/mod/mod_dir.html#directoryindex">DirectoryIndex</a></code> directive, if the
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive server is trying to index a directory. If the configuration files
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive specify</p>
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar <pre class="prettyprint lang-config">DirectoryIndex index</pre>
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p>then the server will arbitrate between <code>index.html</code>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen and <code>index.html3</code> if both are present. If neither
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen are present, and <code>index.cgi</code> is there, the server
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive will run it.</p>
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive <p>If one of the files found when reading the directory does not
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive have an extension recognized by <code>mod_mime</code> to designate
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive its Charset, Content-Type, Language, or Encoding, then the result
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim depends on the setting of the <code class="directive"><a href="/mod/mod_mime.html#multiviewsmatch">MultiViewsMatch</a></code> directive. This
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive directive determines whether handlers, filters, and other
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive extension types can participate in MultiViews negotiation.</p>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="methods" id="methods">The Negotiation Methods</a></h2>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen <p>After httpd has obtained a list of the variants for a given
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen resource, either from a type-map file or from the filenames in
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the directory, it invokes one of two methods to decide on the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen 'best' variant to return, if any. It is not necessary to know
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen any of the details of how negotiation actually takes place in
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen order to use httpd's content negotiation features. However the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen rest of this document explains the methods used for those
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive interested. </p>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen algorithm</strong> is used in the normal case. The httpd
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen algorithm is explained in more detail below. When this
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen algorithm is used, httpd can sometimes 'fiddle' the quality
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen factor of a particular dimension to achieve a better result.
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen The ways httpd can fiddle quality factors is explained in
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen more detail below.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li><strong>Transparent content negotiation</strong> is used
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen when the browser specifically requests this through the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen mechanism defined in RFC 2295. This negotiation method gives
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the browser full control over deciding on the 'best' variant,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the result is therefore dependent on the specific algorithms
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen used by the browser. As part of the transparent negotiation
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen process, the browser can ask httpd to run the 'remote
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variant selection algorithm' defined in RFC 2296.</li>
181e56d8b348d301d615ccf5465ae600fee2867berikabele<h3><a name="dimensions" id="dimensions">Dimensions of Negotiation</a></h3>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <td>Browser indicates preferences with the <code>Accept</code>
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl header field. Each item can have an associated quality factor.
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl Variant description can also have a quality factor (the "qs"
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl parameter).</td>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <td>Browser indicates preferences with the
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl <code>Accept-Language</code> header field. Each item can have
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl a quality factor. Variants can be associated with none, one or
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl more than one language.</td>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <td>Browser indicates preference with the
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl <code>Accept-Encoding</code> header field. Each item can have
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl a quality factor.</td>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <td>Browser indicates preference with the
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl <code>Accept-Charset</code> header field. Each item can have a
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl quality factor. Variants can indicate a charset as a parameter
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl of the media type.</td>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen<h3><a name="algorithm" id="algorithm">httpd Negotiation Algorithm</a></h3>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen <p>httpd can use the following algorithm to select the 'best'
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variant (if any) to return to the browser. This algorithm is
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen not further configurable. It operates as follows:</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>First, for each dimension of the negotiation, check the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen appropriate <em>Accept*</em> header field and assign a
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen quality to each variant. If the <em>Accept*</em> header for
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen any dimension implies that this variant is not acceptable,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen eliminate it. If no variants remain, go to step 4.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen Select the 'best' variant by a process of elimination. Each
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen of the following tests is applied in order. Any variants
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen not selected at each test are eliminated. After each test,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen if only one variant remains, select it as the best match
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen and proceed to step 3. If more than one variant remains,
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf move on to the next test.
70fce89e67f707c03f70d437a64e189a205ffc35jsl <li>Multiply the quality factor from the <code>Accept</code>
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl header with the quality-of-source factor for this variants
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl media type, and select the variants with the highest
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl value.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select the variants with the highest language quality
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen factor.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select the variants with the best language match,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen using either the order of languages in the
70fce89e67f707c03f70d437a64e189a205ffc35jsl <code>Accept-Language</code> header (if present), or else
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl the order of languages in the <code>LanguagePriority</code>
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl directive (if present).</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select the variants with the highest 'level' media
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen parameter (used to give the version of text/html media
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen types).</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select variants with the best charset media
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl header line. Charset ISO-8859-1 is acceptable unless
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl explicitly excluded. Variants with a <code>text/*</code>
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl media type but not explicitly associated with a particular
f92d094f13138be62bcc1a4b8187d72705d2cb05jsl charset are assumed to be in ISO-8859-1.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select those variants which have associated charset
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen media parameters that are <em>not</em> ISO-8859-1. If
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen there are no such variants, select all variants
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen instead.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select the variants with the best encoding. If there
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen are variants with an encoding that is acceptable to the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen user-agent, select only these variants. Otherwise if
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen there is a mix of encoded and non-encoded variants,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen select only the unencoded variants. If either all
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen variants are encoded or all variants are not encoded,
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen select all variants.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select the variants with the smallest content
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen length.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>Select the first variant of those remaining. This
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen will be either the first listed in the type-map file, or
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen when variants are read from the directory, the one whose
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen file name comes first when sorted using ASCII code
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen order.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>The algorithm has now selected one 'best' variant, so
70fce89e67f707c03f70d437a64e189a205ffc35jsl return it as the response. The HTTP response header
70fce89e67f707c03f70d437a64e189a205ffc35jsl negotiation (browsers and caches can use this information when
70fce89e67f707c03f70d437a64e189a205ffc35jsl caching the resource). End.</li>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <li>To get here means no variant was selected (because none
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen are acceptable to the browser). Return a 406 status (meaning
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen "No acceptable representation") with a response body
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen consisting of an HTML document listing the available
70fce89e67f707c03f70d437a64e189a205ffc35jsl indicate the dimensions of variance.</li>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen <p>httpd sometimes changes the quality values from what would
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen be expected by a strict interpretation of the httpd
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen negotiation algorithm above. This is to get a better result
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen from the algorithm for browsers which do not send full or
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen accurate information. Some of the most popular browsers send
70fce89e67f707c03f70d437a64e189a205ffc35jsl <code>Accept</code> header information which would otherwise
70fce89e67f707c03f70d437a64e189a205ffc35jsl result in the selection of the wrong variant in many cases. If a
70fce89e67f707c03f70d437a64e189a205ffc35jsl browser sends full and correct information these fiddles will not
70fce89e67f707c03f70d437a64e189a205ffc35jsl be applied.</p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele<h3><a name="wildcards" id="wildcards">Media Types and Wildcards</a></h3>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <p>The <code>Accept:</code> request header indicates preferences
70fce89e67f707c03f70d437a64e189a205ffc35jsl for media types. It can also include 'wildcard' media types, such
70fce89e67f707c03f70d437a64e189a205ffc35jsl as "image/*" or "*/*" where the * matches any string. So a request
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen including:</p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele<div class="example"><p><code>Accept: image/*, */*</code></p></div>
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p>would indicate that any type starting "image/" is acceptable,
e2108029921973b4522af1fe5ecd634a2a55ae07slive as is any other type.
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen Some browsers routinely send wildcards in addition to explicit
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive types they can handle. For example:</p>
cdf912a26be170e1528d1f6c9db8a2a8f9937420pcs Accept: text/html, text/plain, image/gif, image/jpeg, */*
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p>The intention of this is to indicate that the explicitly listed
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen types are preferred, but if a different representation is
e2108029921973b4522af1fe5ecd634a2a55ae07slive available, that is ok too. Using explicit quality values,
e2108029921973b4522af1fe5ecd634a2a55ae07slive what the browser really wants is something like:</p>
cdf912a26be170e1528d1f6c9db8a2a8f9937420pcs Accept: text/html, text/plain, image/gif, image/jpeg, */*; q=0.01
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <p>The explicit types have no quality factor, so they default to a
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen preference of 1.0 (the highest). The wildcard */* is given a
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen low preference of 0.01, so other types will only be returned if
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive no variant matches an explicitly listed type.</p>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <p>If the <code>Accept:</code> header contains <em>no</em> q
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen factors at all, httpd sets the q value of "*/*", if present, to
70fce89e67f707c03f70d437a64e189a205ffc35jsl 0.01 to emulate the desired behavior. It also sets the q value of
70fce89e67f707c03f70d437a64e189a205ffc35jsl wildcards of the format "type/*" to 0.02 (so these are preferred
70fce89e67f707c03f70d437a64e189a205ffc35jsl over matches against "*/*". If any media type on the
70fce89e67f707c03f70d437a64e189a205ffc35jsl <code>Accept:</code> header contains a q factor, these special
70fce89e67f707c03f70d437a64e189a205ffc35jsl values are <em>not</em> applied, so requests from browsers which
70fce89e67f707c03f70d437a64e189a205ffc35jsl send the explicit information to start with work as expected.</p>
181e56d8b348d301d615ccf5465ae600fee2867berikabele<h3><a name="exceptions" id="exceptions">Language Negotiation Exceptions</a></h3>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen <p>New in httpd 2.0, some exceptions have been added to the
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive negotiation algorithm to allow graceful fallback when language
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive negotiation fails to find a match.</p>
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive <p>When a client requests a page on your server, but the server
70fce89e67f707c03f70d437a64e189a205ffc35jsl cannot find a single page that matches the
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive the browser, the server will return either a "No Acceptable
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive Variant" or "Multiple Choices" response to the client. To avoid
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen these error messages, it is possible to configure httpd to ignore
70fce89e67f707c03f70d437a64e189a205ffc35jsl the <code>Accept-language</code> in these cases and provide a
70fce89e67f707c03f70d437a64e189a205ffc35jsl document that does not explicitly match the client's request. The
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <code class="directive"><a href="/mod/mod_negotiation.html#forcelanguagepriority">ForceLanguagePriority</a></code>
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive directive can be used to override one or both of these error
70fce89e67f707c03f70d437a64e189a205ffc35jsl messages and substitute the servers judgement in the form of the
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim <code class="directive"><a href="/mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive directive.</p>
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive <p>The server will also attempt to match language-subsets when no
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive other match can be found. For example, if a client requests
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive documents with the language <code>en-GB</code> for British
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive English, the server is not normally allowed by the HTTP/1.1
103f414dc9a63f76c48bc1d81162ea6f3c5ef495slive standard to match that against a document that is marked as simply
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive <code>en</code>. (Note that it is almost surely a configuration
2df40fa998d3364133c4dd29eb395f5ae70dfc1fslive error to include <code>en-GB</code> and not <code>en</code> in the
70fce89e67f707c03f70d437a64e189a205ffc35jsl <code>Accept-Language</code> header, since it is very unlikely
70fce89e67f707c03f70d437a64e189a205ffc35jsl that a reader understands British English, but doesn't understand
70fce89e67f707c03f70d437a64e189a205ffc35jsl English in general. Unfortunately, many current clients have
70fce89e67f707c03f70d437a64e189a205ffc35jsl default configurations that resemble this.) However, if no other
70fce89e67f707c03f70d437a64e189a205ffc35jsl language match is possible and the server is about to return a "No
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim Acceptable Variants" error or fallback to the <code class="directive"><a href="/mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>, the server
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive will ignore the subset specification and match <code>en-GB</code>
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen against <code>en</code> documents. Implicitly, httpd will add
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive the parent language to the client's acceptable language list with
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive a very low quality value. But note that if the client requests
e6b1bd85e7da3cac168dfef875298c55829c7ce1nd "en-GB; q=0.9, fr; q=0.8", and the server has documents
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive designated "en" and "fr", then the "fr" document will be returned.
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive This is necessary to maintain compliance with the HTTP/1.1
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive specification and to work effectively with properly configured
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive clients.</p>
70fce89e67f707c03f70d437a64e189a205ffc35jsl <p>In order to support advanced techniques (such as cookies or
5d81a8bafa2703e966db5bfd5abb33b176d47589nd special URL-paths) to determine the user's preferred language,
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen since httpd 2.0.47 <code class="module"><a href="/mod/mod_negotiation.html">mod_negotiation</a></code> recognizes
5d81a8bafa2703e966db5bfd5abb33b176d47589nd <code>prefer-language</code>. If it exists and contains an
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim appropriate language tag, <code class="module"><a href="/mod/mod_negotiation.html">mod_negotiation</a></code> will
5d81a8bafa2703e966db5bfd5abb33b176d47589nd try to select a matching variant. If there's no such variant,
5d81a8bafa2703e966db5bfd5abb33b176d47589nd the normal negotiation process applies.</p>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">SetEnvIf Cookie "language=(.+)" prefer-language=$1
4aa603e6448b99f9371397d439795c91a93637eandHeader append Vary cookie</pre>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="extensions" id="extensions">Extensions to Transparent Content
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen<p>httpd extends the transparent content negotiation protocol (RFC
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive2295) as follows. A new <code>{encoding ..}</code> element is used in
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slivevariant lists to label variants which are available with a specific
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slivecontent-encoding only. The implementation of the RVSA/1.0 algorithm
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive(RFC 2296) is extended to recognize encoded variants in the list, and
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16sliveto use them as candidate variants whenever their encodings are
70fce89e67f707c03f70d437a64e189a205ffc35jslacceptable according to the <code>Accept-Encoding</code> request
70fce89e67f707c03f70d437a64e189a205ffc35jslheader. The RVSA/1.0 implementation does not round computed quality
70fce89e67f707c03f70d437a64e189a205ffc35jslfactors to 5 decimal places before choosing the best variant.</p>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="naming" id="naming">Note on hyperlinks and naming conventions</a></h2>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>If you are using language negotiation you can choose between
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen different naming conventions, because files can have more than
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen one extension, and the order of the extensions is normally
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive irrelevant (see the <a href="mod/mod_mime.html#multipleext">mod_mime</a> documentation
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen for details).</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>A typical file has a MIME-type extension (<em>e.g.</em>,
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <code>html</code>), maybe an encoding extension (<em>e.g.</em>,
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive (<em>e.g.</em>, <code>en</code>) when we have different
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen language variants of this file.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>Here some more examples of filenames together with valid and
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen invalid hyperlinks:</p>
e884f58207082fa2136d5fc86635c31252338948erikabele <p>Looking at the table above, you will notice that it is always
e884f58207082fa2136d5fc86635c31252338948erikabele possible to use the name without any extensions in a hyperlink
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive (<em>e.g.</em>, <code>foo</code>). The advantage is that you
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen can hide the actual type of a document rsp. file and can change
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive <code>shtml</code> or <code>cgi</code> without changing any
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen hyperlink references.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>If you want to continue to use a MIME-type in your
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive hyperlinks (<em>e.g.</em> <code>foo.html</code>) the language
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen extension (including an encoding extension if there is one)
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen must be on the right hand side of the MIME-type extension
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="caching" id="caching">Note on Caching</a></h2>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>When a cache stores a representation, it associates it with
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the request URL. The next time that URL is requested, the cache
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen can use the stored representation. But, if the resource is
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen negotiable at the server, this might result in only the first
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen requested variant being cached and subsequent cache hits might
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen return the wrong response. To prevent this, httpd normally
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen marks all responses that are returned after content negotiation
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen as non-cacheable by HTTP/1.0 clients. httpd also supports the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen HTTP/1.1 protocol features to allow caching of negotiated
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen responses.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>For requests which come from a HTTP/1.0 compliant client
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim (either a browser or a cache), the directive <code class="directive"><a href="/mod/mod_negotiation.html#cachenegotiateddocs">CacheNegotiatedDocs</a></code> can be
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive used to allow caching of responses which were subject to
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive negotiation. This directive can be given in the server config or
dd9f0e560e29dc86fba5f5d4fa5e72cda5cefb16slive virtual host, and takes no arguments. It has no effect on requests
cfebc848e619d381e71d40b6f489db4aac180ee5rbowen <p>For HTTP/1.1 clients, httpd sends a <code>Vary</code> HTTP
221e8a19d2201546e7efe590924383c2a7f0fd72slive response header to indicate the negotiation dimensions for the
221e8a19d2201546e7efe590924383c2a7f0fd72slive response. Caches can use this information to determine whether a
221e8a19d2201546e7efe590924383c2a7f0fd72slive subsequent request can be served from the local copy. To
221e8a19d2201546e7efe590924383c2a7f0fd72slive encourage a cache to use the local copy regardless of the
221e8a19d2201546e7efe590924383c2a7f0fd72slive negotiation dimensions, set the <code>force-no-vary</code> <a href="env.html#special">environment variable</a>.</p>
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim<p><span>Available Languages: </span><a href="/en/content-negotiation.html" title="English"> en </a> |
ee649f9236fe7fcf255bbfa11f2cce080f996521sf<a href="/fr/content-negotiation.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<a href="/ja/content-negotiation.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd<a href="/ko/content-negotiation.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/tr/content-negotiation.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/content-negotiation.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
205f749042ed530040a4f0080dbcb47ceae8a374rjung<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();