What 431 means
The request’s headers are too large, either in total or because one header is too long. The server won’t process it.
When servers send it
Almost always because of cookies. A site sets more and bigger cookies over time until the Cookie header goes over the server’s limit.
Common causes
- Too many cookies for a domain, often from analytics and A/B testing tools.
- A large session token or JWT stored in a cookie.
- Cookies set on the parent domain being sent to every subdomain.
- A very long
Refereror custom header.
How to fix it as a developer
- Look at the
Cookieheader size in developer tools. - Store less in cookies: keep a session id there and the data on the server.
- Set cookies on the narrowest domain and path they need.
- Node.js’s default header limit is 16 KB (
--max-http-header-size). Raising server limits is a short-term fix.
How to fix it as a visitor
- Clear the cookies for this site, then reload.
- Try a private window to check whether cookies are the cause.
Related codes
- 400 Bad Request: The server can’t or won’t handle the request because something in it is malformed.
- 413 Content Too Large: The request body, such as an upload, is bigger than the server will accept.
- 414 URI Too Long: The URL is longer than the server is willing to read.
Where it’s defined
431 Request Header Fields Too Large is defined in RFC 6585, section 5. It’s a 4xx code, the client error class: something is wrong with the request, so sending it again unchanged won’t help.
Other 4xx codes
400 Bad Request · 401 Unauthorized · 402 Payment Required · 403 Forbidden · 404 Not Found · 405 Method Not Allowed · 406 Not Acceptable · 408 Request Timeout · 409 Conflict · 410 Gone · 413 Content Too Large · 414 URI Too Long · 415 Unsupported Media Type · 418 I’m a teapot · 422 Unprocessable Content · 429 Too Many Requests · 451 Unavailable For Legal Reasons · 499 Client Closed Request
Or search them all in the HTTP status code list.