Content-Negotiation

Joe Gregorio has a problem with content negotiation, he concludes you shouldn’t use it. The reasons seem to be two-fold, you might it get wrong, and it doesn’t let you specify a specific representation when you can’t control the Accept headers to a specific format. Neither of these are good reasons not to use content negotiation, we all might get something wrong, content-negotiation isn’t particularly hard, we can generally just trust our servers configuration, Apache’s multiviews are reliable for example. Getting a specific representation is easy, you just ensure that the resource is also available with a specific url. With multiviews for example you can have /moomin content-negotiate, and /moomin.html return an html representation or /moomin.rss return an RSS one.

Content negotiation on mime-types isn’t useful as language etc. not least because browsers such as Mozilla, don’t seem to get the idea preferring the generic over the specific. However content negotiation is useful, and Joe’s problems revolve around his implementation, and not the concept as far as I can see.

Content negotiated content should always be available from a unique URI - not least because you should link to the specific formats from a 406 response and non-content-negotiated formats are required for that.

There’s also the question of how reliable a document which is deliberately served with the wrong mime-type is…

Comments