HTTP 406 Not Acceptable vs 431 Request Header Fields Too Large
Both HTTP 406 (Not Acceptable) and 431 (Request Header Fields Too Large) belong to the 4xx Client Error category. 406 indicates that the server cannot produce a response matching the Accept headers sent by the client. Meanwhile, 431 means that the server refuses to process the request because an individual header field or all headers collectively are too large.
Description
The server cannot produce a response matching the Accept headers sent by the client.
When You See It
When requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).
How to Fix
Adjust the Accept header to a format the server supports.
Description
The server refuses to process the request because an individual header field or all headers collectively are too large.
When You See It
When cookies accumulate to an excessive size, or a single header (like Authorization) is too long.
How to Fix
Reduce header sizes. Clear excessive cookies. Use shorter tokens.
Key Differences
HTTP 406: The server cannot produce a response matching the Accept headers sent by the client.
HTTP 431: The server refuses to process the request because an individual header field or all headers collectively are too large.
You encounter 406 when when requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).
You encounter 431 when when cookies accumulate to an excessive size, or a single header (like Authorization) is too long.
When to Use Which
For 406 (Not Acceptable): Adjust the Accept header to a format the server supports. For 431 (Request Header Fields Too Large): Reduce header sizes. Clear excessive cookies. Use shorter tokens.