What does HTTP 406 mean?
The server cannot produce a response matching the client’s Accept headers. Content negotiation failed: the client asked for, say, application/xml only, and the server can only produce JSON. Some security modules (mod_security) also misuse 406 to block requests.
4xx Client error: The request has a problem the client can fix: wrong URL, missing credentials, bad data or too many requests.
Common causes of a 406 error
- Strict
Acceptheader from an API client. - A web application firewall rule.
How to fix 406 Not Acceptable
- Send
Accept: */*or a supported type. - Check WAF logs if browsers get 406.
406 and SEO
Rare for web pages; if Googlebot receives 406 the page is not indexed.
Example response
HTTP/1.1 406 Not Acceptable
How to return a 406 response
Node.js (Express)
res.status(406).json({ error: 'Not Acceptable' });PHP
http_response_code(406);Python (Flask)
return {'error': 'Not Acceptable'}, 406Go (net/http)
w.WriteHeader(406)nginx
return 406;
Related status codes
- 415 Unsupported Media Type — The server does not support the format of the request body.
- 400 Bad Request — The server cannot process the request because it is malformed.
Check which status code a URL returns with the HTTP header checker.
Questions fréquentes
What does status code 406 mean?
Accept headers.How do I fix a 406 error?
Accept: */* or a supported type. Check WAF logs if browsers get 406.