---
title: "Hyper Content Negotiation: One Canonical URL, Multiple Representations"
author: "Paul Kinlan"
published: "2026-10-14"
url: "https://aifoc.us/hyper-content-negotiation/"
tags: ["http", "content-negotiation", "rfc-9110", "markdown", "json-ld", "hypermedia"]
---

# Hyper Content Negotiation: One Canonical URL, Multiple Representations

> HTTP Accept negotiation enables a single canonical URI to deliver styled HTML to browsers, compact Markdown to text-oriented readers, and typed JSON-LD graphs to structured consumers without duplicate endpoints.

## The Token Overhead of HTML Chrome

Web pages built for interactive visual layout carry substantial structural overhead: stylesheet declarations, inline SVG icons, navigation bars, ARIA landmarks, wrapper elements, and script tags.

When an automated client fetches a styled HTML page directly into a bounded context window, 65% to 85% of the transferred bytes and tokens describe presentation chrome rather than document prose or reference links.

Stripping tags after fetching wastes both origin egress and client parser cycles, while fragile heuristics can drop headings, tables, or attribution metadata.

## RFC 9110 Accept Header Mechanics

RFC 9110 Section 12.5.1 defines proactive content negotiation via the Accept request header. Clients list acceptable media ranges accompanied by optional quality weights (q-values between 0.000 and 1.000).

Specificity governs tie-breaking before server preference: an exact media type such as text/markdown outranks a type wildcard such as text/*, which outranks */*. A q-value of 0 explicitly excludes a representation.

By evaluating Accept on the canonical resource URI /docs/:slug, one URL serves human browsers (text/html), text parsers (text/markdown), and linked-data pipelines (application/ld+json) without fragmenting URLs.

## Vary: Accept and Shared Edge Caching

A negotiated endpoint without a Vary: Accept response header causes cache poisoning across client classes: an edge cache storing text/markdown under the canonical key would serve Markdown bytes to the next browser request.

Emitting Vary: Accept instructs intermediate CDNs and browser caches to partition cache entries by the negotiated Accept header value alongside the request URI.

## Discoverability via Link Alternates

Clients that cannot set custom Accept headers—such as browser address bars or static crawlers—rely on explicit hypermedia links. Responses include HTTP Link headers and HTML <link rel="alternate"> elements pointing to ?format=markdown and ?format=jsonld.

This preserves one primary URI as the canonical identifier while exposing deterministic format overrides for inspection and debugging.

## Failure Modes in Naive Content Proxies

Edge transformers that fetch arbitrary remote URLs without validating target hostnames and resolved IP ranges introduce Server-Side Request Forgery (SSRF) exposure against loopback interfaces and cloud metadata endpoints.

Production edge negotiators enforce HTTPS-only transport, private CIDR rejection on every redirect hop, bounded read streams, and strict request timeouts.

## References

- [Hyper Content Negotiation essay](https://aifoc.us/hyper-content-negotiation/) (canonical)
- [Hypermedia systems overview](https://aifoc.us/hypermedia/) (related)
- [A link is all you need](https://aifoc.us/a-link-is-all-you-need/) (related)
- [RFC 9110 Section 12.5.1 (Accept)](https://www.rfc-editor.org/rfc/rfc9110#section-12.5.1) (spec)
- [Schema.org Article vocabulary](https://schema.org/Article) (spec)
