Module mod_negotiation

Important: Information for this topic supports the latest PTF levels for HTTP Server for i5/OS . It is recommended that you install the latest PTFs to upgrade to the latest level of the HTTP Server for i5/OS. Some of the topics documented here are not available prior to this update. See http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm Link outside Information Center for more information.

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:

See Content negotiation for HTTP Server (powered by Apache) 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:
Parameter One: level
  • The level parameter is an integer specifying the version of the media type. For text/html, this defaults to '2', otherwise '0'.
Parameter Two: qs
  • The qs parameter is a floating-point number with a value in the range of '0.0' to '1.0', indicating the relative quality of this variant compared to the other available variants, independent of the client's capabilities. For example, a '.jpeg' file is usually of higher source quality than an '.ascii' file it is attempting to represent a photograph. However, if the resource being represents is ASCII art, then an ASCII file would have a higher source quality than a '.jpeg' file. All Qs values therefore specific to a given source. For example:
    Content-Type: image/jpeg; Qs=0.8
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

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.

Note: When specifying both Prefer and Fallback options, the behavior is the same regardless of the order in which they are specified.

See DefaultLanguage, AddLanguage and LanguagePriorityfor 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.

Note: This directive only has an effect if a best language cannot be determined by any other means. If the client expresses a language preference, this directive has no effect on the file selected during content negotiation.