What HTTP 406 means
The client asked for a format (Accept: application/xml), language or encoding that the server can’t provide. Most servers ignore Accept and send their default, so 406 is uncommon. Some security modules, like ModSecurity, return it to block suspicious requests.
How to fix a 406 error
-
Send
Accept: application/jsonor*/*.
Retrying
No. Fix the request first; sending it again unchanged will get the same response.
Example response
HTTP/1.1 406 Not Acceptable
Date: Wed, 21 Oct 2026 10:30:00 GMT
Content-Type: application/json
How to return 406
res.status(406).json({ error: 'Not Acceptable' });
from fastapi import HTTPException
raise HTTPException(status_code=406, detail="Not Acceptable")
http.Error(w, http.StatusText(http.StatusNotAcceptable), http.StatusNotAcceptable)
location /private/ {
return 406;
}
Related status codes
- 415 Unsupported Media Type : The server doesn’t accept the request body’s format.
- 400 Bad Request : The server can’t process the request because it is malformed.
- 300 Multiple Choices : The resource has several representations and the client should pick one.
Other 4xx status codes
400 Bad Request · 401 Unauthorized · 402 Payment Required · 403 Forbidden · 404 Not Found · 405 Method Not Allowed · 407 Proxy Authentication Required · 408 Request Timeout · 409 Conflict · 410 Gone · 411 Length Required · 412 Precondition Failed · 413 Content Too Large · 414 URI Too Long · 415 Unsupported Media Type · 416 Range Not Satisfiable · 417 Expectation Failed · 418 I’m a Teapot · 421 Misdirected Request · 422 Unprocessable Content · 423 Locked · 424 Failed Dependency · 425 Too Early · 426 Upgrade Required · 428 Precondition Required · 429 Too Many Requests · 431 Request Header Fields Too Large · 444 No Response · 451 Unavailable For Legal Reasons · 499 Client Closed Request
See the full list of HTTP status codes.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does HTTP 406 Not Acceptable mean?
HTTP 406 Not Acceptable means the server can’t produce a response in any format listed in the Accept headers. The client asked for a format (Accept: application/xml), language or encoding that the server can’t provide. Most servers ignore Accept and send their default, so 406 is uncommon. Some security modules, like ModSecurity, return it to block suspicious requests.
How do I fix HTTP 406?
Send Accept: application/json or */*.