Not Acceptable
Production Risk
Low. This is a normal part of content negotiation. It typically affects API clients more than web browsers, which are usually more flexible with their 'Accept' headers.
This response is sent when the web server, after performing server-driven content negotiation, does not find any content that conforms to the criteria given by the user agent in the 'Accept' headers.
- 1A client requests JSON data (Accept: application/json) from an endpoint that can only serve XML.
- 2A browser requests a response in a language (Accept-Language: fr) that the server does not support.
- 3The client requests a specific character set (Accept-Charset) that is unavailable.
A command-line tool requests a PNG image from a server that can only provide JPEG images.
GET /image HTTP/1.1 Host: example.com Accept: image/png
expected output
HTTP/1.1 406 Not Acceptable
Fix 1
Adjust Client 'Accept' Headers
WHEN You control the client.
// Modify the request header Accept: application/xml, application/json
Why this works
Client-Side Correction
Fix 2
Implement Content Transformation
WHEN You control the server.
// On the server, add support for JSON output
if (req.headers.accept === 'application/json') {
// convert data to JSON and send
}Why this works
Server-Side Logic
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev