What is Content Negotiation?

Content negotiation selects a representation of a resource according to client preferences or capabilities. In server-driven HTTP negotiation, request headers such as Accept or Accept-Language help the server choose a response.

How Content Negotiation works

A resource can have multiple representations, such as JPEG and AVIF versions of the same image. A server may inspect Accept and choose one, returning the actual representation’s Content-Type. When that choice varies by a request header, Vary communicates the dependency to caches. HTML selection with picture and source works differently: the browser chooses among explicit URLs rather than asking a single URL to negotiate its representation.

Key facts

  1. Negotiating an image format with Accept and negotiating HTTP compression with Accept-Encoding are different decisions.
  2. The response MIME type must describe the bytes sent, regardless of the resource URL’s filename extension.
  3. A Vary header communicates cache variation; it does not create the representations or configure every CDN automatically. Verify the cache behavior of the delivery service in use.

When Content Negotiation matters

Use explicit variant URLs or correctly configured negotiation when delivering several image formats. Make the cache distinguish every request property that actually affects the selected response.

Sources

Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

Try Transloadit for free