Type your own Accept and Accept-Language: Dodi’s gudang picks JSON, HTML or XML (or 406), and see what a halte without Vary hands over. An interactive Content…
A versatile API serves many formats from one endpoint. Knowing negotiation means knowing why curl gets JSON but a browser gets HTML from the same URL, when a 406 appears, and why forgetting Vary makes a CDN serve the wrong format.
The client proposes with q, the server decides
Vary: Accept. A cache (CDN, proxy) keeps one copy per URL without knowing there are several representations, so the next client gets the one made for the request before. Vary on every request header that changes the body.q=0 is the same as not named q=0 refuses actively, even under */*. A type not named is still covered by a wildcard (if there is one), and without one it is not accepted.406 Not Acceptable so the client knows, or serve the default format and document it.text/html at q 1 beats */*;q=0.8: the browser gets HTML.q=0 under */* An active refusal beats the wildcard by being more specific.406 Not Acceptable Ask for a format the gudang does not make, with no fallback.ja, get en as the fallback The q order in Accept-Language: the gudang picks the highest one it has.