The next revision of the transport protocol, HTTP 1.1, addresses many of these problems and introduces new HTTP headers allowing cache agents to serve negotiated documents. Meanwhile, one way around the problem is to negotiate redirected documents. In this way, a small transfer is made to the origin server, which then returns the URL of a cacheable document with the required characteristics.
This Perl script (select_lang) is an example of how this may be done. It selects a document based on the value of the Accept-Language header. The easiest implementation relies on the Action and AddHandler directives in Apache. For instance, one might install select_lang in cgi-bin, then use the directives
AddHandler select_lang lang Action select_lang /cgi-bin/select_langwhich will invoke the script on any file with a suffix of .lang, e.g. http://some.org/somewhere/some.lang
Given a URL such as .../some.lang, and an HTTP Accept-Language header such as
en_US,fr,de ,
the script will search for some.en_us.html (US English), some.en.html (English), some.fr.html (French),
some.de.html (German), defaulting to some.html. some.lang must
exist, though it may be of zero length.
Here it is in action.
If the size of the various HTML files is fairly small (a few kb), it may be easier to make the document itself content-negotiable, which will involve one trasfer from the origin server, instead of one from the origin (a redirect), and one from cache.
Vancouver Webpages