What Does 406 Mean

Short Answer

HTTP 406 Not Acceptable is a client error status code indicating the server cannot produce a response matching the client's Accept headers. It is part of content negotiation in HTTP/1.1.

Overview

HTTP 406 Not Acceptable is a client error response status code indicating that the server cannot produce a response matching the list of acceptable values defined in the request’s proactive content negotiation headers, most commonly the Accept, Accept-Language, or Accept-Charset headers. The 406 status code is part of the HTTP/1.1 specification and is used to inform the client that although the server understood the request, it cannot fulfill it because the requested resource does not exist in a format acceptable to the client.

History / Background

The 406 status code was introduced in the original HTTP/1.1 specification, RFC 2068, published in 1997, and later refined in RFC 2616 (1999) and RFC 7231 (2014). It was designed to support server-driven content negotiation, where the server selects the best representation of a resource based on the client’s preferences. The code is less commonly used in modern web development because many servers and frameworks default to returning a 200 or 404 response even when content negotiation fails, often by ignoring the Accept header or falling back to a default representation.

Importance and Impact

The 406 status code plays a role in RESTful API design and web services where content negotiation is critical. It allows servers to explicitly signal that the requested representation (e.g., JSON, XML, HTML) is not available, enabling clients to handle the situation gracefully, such by requesting a different format or falling back to a default. Its impact is primarily in technical contexts; most end users never encounter a 406 error directly because browsers typically send Accept headers that match common content types.

Why It Matters

Understanding HTTP 406 is important for web developers, API designers, and system administrators who implement content negotiation. It helps diagnose issues where a client requests a specific data format that the server does not support, leading to failed responses. Proper handling of 406 can improve interoperability and user experience by providing clear error messages or alternative options. In practice, many servers avoid returning 406 and instead return a 200 with a default format or a 404, which can obscure the real problem.

Common Misconceptions

Myth

HTTP 406 means the client’s request is invalid or malformed.

Fact

406 is a client error, but it specifically indicates that the server cannot produce a response in a format acceptable to the clientβ€”not that the request itself is invalid. The request syntax is correct, but the server lacks a matching representation.

Myth

406 is the same as 415 Unsupported Media Type.

Fact

415 is used when the server refuses to accept a request payload (e.g., POST data) in an unsupported format, while 406 applies to the response format requested via Accept headers. They are different aspects of content negotiation.

Myth

A 406 error can be fixed by changing the URL.

Fact

The issue is not the URL but the Accept headers sent by the client. Modifying the client’s request to accept a format the server offers (e.g., adding a broader Accept header) resolves the error.

FAQ

What does HTTP 406 mean?

HTTP 406 Not Acceptable means the server cannot produce a response in a format that matches the client's Accept headers. It is a client error status code used in content negotiation.

How to fix a 406 error?

To fix a 406 error, the client should modify its request to include an Accept header that specifies a media type the server supports, or the server should be configured to provide a representation that matches the client's preferences.

Is 406 a client or server error?

406 is classified as a 4xx client error. It indicates that the client's request headers (specifically Accept) are not satisfied by the server's available representations.

When should a server return 406?

A server should return 406 when it cannot produce any representation of the requested resource that matches the list of acceptable values in the request's proactive content negotiation headers, and no default representation is available.

References

  1. RFC 7231 – Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
  2. MDN Web Docs – 406 Not Acceptable
  3. IETF RFC 2616 – Hypertext Transfer Protocol – HTTP/1.1
  4. HTTP Status Dogs – 406
  5. Wikipedia – List of HTTP status codes

Related Terms

Leave a Reply

Your email address will not be published. Required fields are marked *