๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Web Development Intermediate

What is Content Negotiation?

An HTTP mechanism where client and server agree on the best representation of a resource based on format, language, or encoding preferences.

Content negotiation allows serving different representations of the same resource based on client capabilities and preferences. The Accept header specifies preferred media types (application/json, text/html). Accept-Language indicates language preference (en, de, fr). Accept-Encoding specifies compression support (gzip, br). The server examines these headers and responds with the best match, indicating the choice via Content-Type, Content-Language, and Content-Encoding response headers. This enables APIs to return JSON or XML from the same endpoint, serve WebP images to supporting browsers with JPEG fallback, and deliver localized content โ€” all at the same URL.

Related Terms

CORS Headers
HTTP headers that control cross-origin resource sharing between different domains, specifying allowed origins, methods, and headers.
Middleware
Software that sits between the request and response in a web application, performing processing like authentication or logging.
TypeScript
A typed superset of JavaScript that adds static type checking, interfaces, and advanced IDE support to JavaScript development.
REST (Representational State Transfer)
An architectural style for designing networked applications using standard HTTP methods and stateless communication.
HTTP/2
The second major version of HTTP that improves performance through multiplexing, header compression, and server push.
Static Site Generator (SSG)
A tool that generates a complete static HTML website from templates and content at build time, requiring no server-side processing.
View All Web Development Terms โ†’