HTTP Content Negotiation

Assignment 1 — Web Architecture Fall 2008

Assigned: Thursday, September 11th, 2008
Due: Tuesday, September 23rd, 2008


This assignment looks at how to configure a Web server to support HTTP content negotiation based on language information.


  1. Firefox Live HTTP Headers
  2. HTTP Request Header Viewer
  3. HTTP Response Header Viewer
  4. Apache Content Negotiation (Multiviews)
  5. Apache .htaccess Files


We are going to be playing around with the Apache Web server and will use the installation already run by the iSchool. You are welcome to use your own installation, but we can not support you with the details about how your personal computer is configured. With a wide range of backgrounds in this class, it is difficult to tailor the difficulty level of the assignments. If you have troubles figuring out some of the basic mechanics of how to make things work or set up the environment, just get in touch.

You will need an iSchool computer account – if you are not an iSchool student, please visit the iSchool account request form and enter Erik Wilde as your sponsor. Once you have an account, see the iSchool intranet computing page for complete computing set up info. The part most relevant to this assignment is the part talking about the setup of your personal Web space.

This assignment deals with maybe the most basic Web-based service next to pure file retrieval: HTTP content negotiation. By configuring a Web server appropriately, users can be served with documents that match their language preference. This is much better than the usual please choose your language way of having the user answer this question for each Web site they are visiting.

The following steps are intended to encourage exploring the services implemented by a Web server. Apache is a highly configurable piece of software, and we will only look at a part of one of the many functions it provides. When completing the following steps, read a bit more of the documentation than you absolutely need and explore some more of Apache's features!

  1. HTTP Headers: Explore what your browsers sends as HTTP request headers and what you get from your favorite Web site as HTTP response headers (Firefox LiveHTTPHeaders is an excellent tool for this). Try to understand all HTTP Headers in both types of messages, and change your browser's configuration in a way which changes the HTTP request headers it is sending. This is most easily done by changing you language preference, which also sets you up for the following steps.
  2. Setting up Content Negotiation: We use Apache's content negotiation to let the server choose the best representation of a Web page, based on the language preference sent by the browser in the Accept-Language header. This involves two things: (a) set up content negotiation using Apaches Multiviews feature, which you have to request explicitly in an .htaccess file in your Web space's directory; after doing this, (b) rename your two favorite language files (e.g., english and german) appropriately so that the Multiviews feature works. For this second step, you need to find out the magic way of how files need to be named for Apache, which involves using file extensions... After renaming the files, you're finished, your browser's language preference now actually selects the home page in your preferred language!
  3. Fallback: But what happens if a user requests a language which is not provided by the server? To find out, rename both your language-specific files to really obscure languages (such as italian and french) not requested by your browser (or do it the other way around: change your browser's language preference to a language other than the ones you are providing). Using the configuration used so far, the browser now returns the language with the language code which comes first in the alphabet. This is not really useful! Take care of this by defining reasonable LanguagePriority values for your example in your .htaccess file.
  4. No Default: Language priorities have two purposes: resolving a tie when two languages could be served, and selecting a language when no requested language can be served. Now let us assume you don't want to force your preferred language to someone requesting something you don't have available. Add ForceLanguagePriority Prefer to your .htaccess. What happens? Does this look user-friendly?

Come up with some suggestions how you would design a multi-lingual Web site which (a) uses server-side content negotiation, (b) resolves ambiguities in case a user requests more than one provided language, and (c) does not force users to see a language they haven't selected (or does so only in a friendly way). (a) and (b) are simply repetitions, for (c) i would like to see something more creative than let them see Apache's Not Acceptable page.

The deliverables for this assignment is a URI to a working Web site that does content negotiation and a plain text version of the .htaccess file. If you solved this assignment locally on your computer, please send a zip of the complete directory contents and a plain text version of the .htaccess file or the relevant part of the httpd.conf, if you modified the server configuration itself

Creative Commons License Please send comments to
Last modification: Monday, 02-Feb-2009 00:58:06 EST
valid CSS! valid XHTML 1.0!