The statuscode 406 (also known as “HTTP 406 Not Acceptable”) is a client-side error response that occurs during content negotiation between the web browser and server. When a client requests the server with specific format requirements through Accept headers, and the server cannot fulfil those requirements, it returns a 406 status code.
This HTTP status 406 not acceptable error indicates that while the server understood the request, it cannot generate content that matches the client’s acceptable parameters.
What Causes the Status Code 406?
The 406 not acceptable error typically occurs due to several factors. The most common cause is a mismatch between the content types requested by the client and what the server can provide.
For instance, if a browser requests content in XML format through the Accept header, but the server can only provide JSON, it will trigger a 406 response code. Other causes include unsupported character encodings, incorrect content negotiation headers, or MIME type mismatches. 4
Additionally, server misconfiguration or insufficient server capabilities to handle specific content types can lead to the HTTP status code 406. This error represents a communication breakdown between the client’s requirements and the server’s capabilities.
Example
Here’s a typical example of a request and response that results in a 406 not acceptable error:
Request:
GET /products HTTP/2.0
Host: example101.com
Accept: app/xml
In this case, the client specifically requests the content in XML format.
Response:
HTTP/2.0 406 Not Acceptable
Content-Type: text/plain
Content-Length: 75
The server can’t provide a response matching this request.
The server responds with HTTP status 406 not acceptable because it cannot provide the content in XML format as requested by the client.
This example demonstrates how content type mismatches trigger the 406 status code, showing the practical implementation of content negotiation between client and server. The server clearly indicates its inability to fulfil the specific format requirements set by the client’s Accept header.
Reseller Club Hosting Services
Reseller Hosting | Windows Reseller Hosting | Cloud Hosting | VPS Hosting | Managed VPS Hosting | Dedicated Server Hosting | Windows Dedicated Server | Managed Dedicated Server | Linux Shared Hosting | Windows Shared Hosting