Module mod_negotiation
Module mod_negotiation supports directives for the IBM® HTTP Server for i Web server.
Summary
Content negotiation is the selection of the document that best matches the clients capabilities from one of several available documents. There are two implementations of content negotiation:
- A type-map (a file with the handler type-map) which explicitly lists the files containing the variants.
- A MultiViews search (enabled by the MultiViews Options) where the server does an implicit filename pattern match and makes a choice from the results.
See Content negotiation for HTTP Server for more information.
Type maps
A type map has the same format as RFC822 mail headers. It contains document descriptions separated by blank lines, with lines beginning with a pound sign ('#') are treated as comments. A document description consists of several header records. Records may be continued on multiple lines if the continuation lines start with spaces. The leading space will be deleted and the lines concatenated. A header record consists of a keyword name, which always ends in a colon, followed by a value. Whitespace is allowed between the header name and value, and between the tokens of value. The headers allowed are:
Header | Description |
---|---|
Content-Encoding | The encoding of the file. The server only recognizes encoding that is defined by an AddEncoding directive. This normally includes the encoding x-compress for compress'ed files, and x-gzip for gzip'ed files. The x- prefix is ignored for encoding comparisons. |
Content-Language | The language of the variant, as an Internet standard language tag (RFC 1766). An example is en, meaning English. |
Content-Length | The length of the file, in bytes. If this header is not present, then the actual length of the file is used. |
Content-Type | The MIME media type of the document, with optional
parameters. Parameters are separated from the media type and from
one another by a semicolon, with a syntax of name=value. Common parameters
include:
|
URL | The path to the file containing this variant, relative to the map file. |
MultiViews
A MultiViews search is enabled by the MultiViews Option. If the server receives a request for /some/dir/QIBM and /some/dir/QIBM does not exist, then the server reads the directory looking for all files named QIBM.* , and effectively makes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements, and returns that document.
Directives
CacheNegotiatedDocs
Module: mod_negotiation | |
Syntax: CacheNegotiatedDocs on | off | |
Default: CacheNegotiatedDocs off | |
Context: server config, virtual host | |
Override: none | |
Origin: Apache | |
Example: CacheNegotiatedDocs on |
The CacheNegotiatedDocs directive allows content-negotiated documents requested using HTTP/1.0 to be cached by proxy servers.
- Parameter: on | off
- Setting this directive to on could mean that clients behind proxies may retrieve versions of the documents that are not the best match for their abilities. The purpose of this directive is to make cache more efficient. This directive only applies to requests which come from HTTP/1.0 browsers. HTTP/1.1 provides much better control over the caching of negotiated documents, and this directive has no effect in responses to HTTP/1.1 requests.
ForceLanguagePriority
Module: mod_negotiation | |
Syntax: ForceLanguagePriority None | Prefer | Fallback [Prefer | Fallback] | |
Default: ForceLanguagePriority None | |
Context: server config, virtual host, directory, .htaccess | |
Override: FileInfo | |
Origin: Apache | |
Example: See below. |
The ForceLanguagePriority directive uses the given LanguagePriority to satisfy negotiation where the server could otherwise not return a single matching document.
- Parameter: None | Prefer | Fallback
- The Prefer parameter uses LanguagePriority to serve one
valid result, rather than returning an HTTP result 300 (MULTIPLE CHOICES)
when there are several equally valid choices. If the directives below
were given, and the user's Accept-Language header assigned en and de each
as quality .500 (equally acceptable) then the first matching variant
(en) will be served.
LanguagePriority en Fr de ForceLanguagePriority Prefer
- The Fallback parameter uses LanguagePriority to serve a
valid result, rather than returning an HTTP result 406 (NOT ACCEPTABLE).
If the directives below were given, and the user's Accept-Language
only permitted an en language response, but such a variant
isn't found, then the first variant from the LanguagePriority list
is served.
LanguagePriority en Fr de ForceLanguagePriority Fallback
- The Prefer parameter uses LanguagePriority to serve one
valid result, rather than returning an HTTP result 300 (MULTIPLE CHOICES)
when there are several equally valid choices. If the directives below
were given, and the user's Accept-Language header assigned en and de each
as quality .500 (equally acceptable) then the first matching variant
(en) will be served.
Both options, Prefer and Fallback, may be specified, so either the first matching variant from LanguagePriority will be served if more that one variant is acceptable, or the first available document will be served if none of the variants match the client's acceptable list of languages.
See DefaultLanguage, AddLanguage and LanguagePriority for more information.
LanguagePriority
Module: mod_negotiation | |
Syntax: LanguagePriority MIME-lang [MIME-lang...] | |
Default: none | |
Context: server config, virtual host, directory, .htaccess | |
Override: FileInfo | |
Origin: Apache | |
Example: LanguagePriority en Fr de |
The LanguagePriority directive sets the precedence of language variants for the case where the client does not express a preference when handling a MultiViews request. The list of MIME-lang are in order of decreasing preference.
- Parameter: MIME-lang
- The MIME-lang parameter is any Internet standard language tag or MIME language designation.
This directive may be configured multiple times in a container. The directives are processed from the first to the last occurrence.