From: Joshua Slive Apache's support for content negotiation has been updated to
- meet the HTTP/1.1 specification. It can choose the best
+ Apache's supports content negotiation as described in
+ the HTTP/1.1 specification. It can choose the best
representation of a resource based on the browser-supplied
preferences for media type, languages, character set and
- encoding. It is also implements a couple of features to give
- more intelligent handling of requests from browsers which send
+ encoding. It also implements a couple of features to give
+ more intelligent handling of requests from browsers that send
incomplete negotiation information. The full list of headers recognized is: The full list of headers recognized is available in the mod_negotation
+ documentation. If one of the files found when reading the directive is a
- CGI script, it's not obvious what should happen. The code gives
- that case special treatment --- if the request was a POST, or a
- GET with QUERY_ARGS or PATH_INFO, the script is given an
- extremely high quality rating, and generally invoked; otherwise
- it is given an extremely low quality rating, which generally
- causes one of the other views (if any) to be retrieved. If one of the files found when reading the directory does not
+ have an extension recognized by Content Negotiation
-
-
- Using a type map file is preferred over URI:
Content-Type:
image/gif
,
- text/plain
, or
- text/html; level=3
.Content-Language:
en
for English, kr
for Korean,
- etc.).Content-Encoding:
x-compress
for compress'd files, and
- x-gzip
for gzip'd files. The x-
- prefix is ignored for encoding comparisons.Content-Length:
Description:
MultiViews
- because it requires less CPU time, and less file access, to
- parse a file explicitly listing the various resource variants,
- than to have to look at every matching file, and parse its file
- extensions.
Multiviews
@@ -255,13 +202,14 @@
are present, and index.cgi
is there, the server
will run it.
- mod_mime
to designate
+ its Charset, Content-Type, Language, or Encoding, then the result
+ depends on the setting of the MultiViewsMatch
+ directive. This directive determines whether handlers, filters,
+ and other file types can participate in MultiViews
+ negotiation.The Negotiation Methods
After Apache has obtained a list of the variants for a given
@@ -476,33 +424,42 @@
not applied, so requests from browsers which send the
correct information to start with work as expected.
When a client requests a page on your server, but the server + cannot find a single page that matches the Accept-language sent by + the browser, the server will return either a "No Acceptable + Variant" or "Multiple Choices" response to the client. To avoid + these error messages, it is possible to configure Apache to ignore + the Accept-language in these cases and provide a document that + does not explictly match the client's request. The ForceLanguagePriority + directive can be used to override one or both of these error + messages and subsitute the servers judgement in the form of the LanguagePriority + directive.
+ +The ForceLanguagePriority
directive also causes
+ Apache to attempt to match language-subsets against their parent
+ language when no other match can be obtained. For example, if a
+ client requests documents with the language en-GB
for
+ British English, the server is not normally allowed by the
+ HTTP/1.1 standard to return a document that is marked as simply
+ en
. (Note that it is almost surely a configuration
+ error to include en-GB
and not en
in the
+ Accept-Language header, since it is very unlikely that a reader
+ understands British English, but doesn't understand English in
+ general. Unfortunately, many current clients have default
+ configurations that resemble this.) With the
+ ForceLanguagePriority
header, the server can be
+ configured to ignore the subset specification and match
+ en-GB
against en
documents. But note
+ that if the client requests "en-GB; qs=0.9, fr; qs=0.8", and the
+ server has documents designated "en" and "fr", then the "fr"
+ document will be returned regardless of the
+ ForceLanguagePriority
directive. This is necessary
+ to maintain compliance with the HTTP/1.1 specification.
If some of the variants for a particular resource have a - language attribute, and some do not, those variants with no - language are given a very low language quality factor of - 0.001.
- -The reason for setting this language quality factor for - variant with no language to a very low value is to allow for a - default variant which can be supplied if none of the other - variants match the browser's language preferences. For example, - consider the situation with three variants:
- -The meaning of a variant with no language is that it is - always acceptable to the browser. If the request - Accept-Language header includes either en or fr (or both) one - of foo.en.html or foo.fr.html will be returned. If the browser - does not list either en or fr as acceptable, foo.html will be - returned instead.
For more information about content negotiation, see Alan + J. Flavell's Language + Negotiation Notes. But note that this document may not be + updated to include changes in Apache 2.0.
+ -