406 Not Acceptable
When the server responds with the HTTP status code 406 Not Acceptable, it means that the client’s request for the resource included specific requirements through a request header, but the server could not meet those criteria.
You can Check Your URLs HTTP Code for FREE
Introduction
In Action
Sample
Conclusion
Introduction
When the server responds with the HTTP status code 406 Not Acceptable, it means that the client’s request for the resource included specific requirements through a request header, but the server could not meet those criteria.
The server does not offer a default representation of the resource as an alternative.
This typically happens during Content Negotiation when the client specifies certain preferences for the response format, but the server cannot fulfill those preferences.
In Action
When you encounter the 406 Not Acceptable error, it means that the server received a request with specific preferences for the response format, but it couldn’t fulfill those preferences.
For example, if you request an HTML page, but the server only provides plain text, it may respond with this error. However, in most cases, servers will try to provide some acceptable representation of the resource instead of returning this error.
If you see this error, the server will typically include a list of available options that you can choose from.
Sample
In the example, the client asks for the resource in French, but the server cannot provide it in that language.
The server only has German and English versions of the document available.
So, it returns the 406 Not Acceptable response to let the client know that it cannot fulfill the request for the requested language.
Request
GET /news HTTP/1.1
Host: www.example.com
Accept-Language: fr
Response
HTTP/1.1 406 Method Not Acceptable
Content-Type: text/html
Content-Length: 242
< html>
< head>
< title>French Language Not Available< /title>
< /head>
< body>
< p>Please choose a supported language:< /p>
< p>< a href=”/news/news-de.html”>German< /a>< /p>
< p>< a href=”/news/news-en.html”>English< /a>< /p>
< /body>
< /html>
Conclusion
The 406 Not Acceptable status code is returned by the server when the client’s request includes specific headers (e.g., Accept or Accept-Language) to specify content preferences, but the server cannot satisfy those preferences.
This means that the server cannot provide the resource in a format or language that the client can accept, and it typically offers a list of available alternatives for the client to choose from.