More
More
431 Request Header Fields Too Large
The headers are too big, either one header or all of them together.
- Code
431- Reason phrase
- Request Header Fields Too Large
- Class
- 4xx Client error
- Defined in
- RFC 6585 section 5
- Cacheable by default
- No
What it means
Client error: the problem lies with the request. Repeating it unchanged will normally fail again.
When a server should send it. When the request headers are too large, all together or one of them. Usually it is the Cookie header grown too big; nginx returns 400 with "Request Header Or Cookie Too Large" in the same case.
Common causes. Too many or oversized cookies for the domain.
What to do. Clear the site's cookies. Developers should keep cookies small.
How clients and crawlers treat it
Browsers and HTTP clients. Clearing the site's cookies in the browser usually fixes it. The site should stop setting so many or such large cookies.
Google Search. Like every 4xx except 429, it tells Google the content does not exist: an indexed URL is removed from the index, and a new one is not processed. Crawl frequency for the URL gradually drops. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.
Example response
HTTP/1.1 431 Request Header Fields Too Large Content-Type: text/plain; charset=utf-8 Request Header Fields Too Large
How to send 431
location /example {
return 431;
}
RewriteEngine On RewriteRule ^example$ - [R=431,L]
http_response_code(431); echo 'Request Header Fields Too Large'; exit;
res.writeHead(431, { 'Content-Type': 'text/plain' });
res.end('Request Header Fields Too Large');
# in a view function return 'Request Header Fields Too Large', 431
Change the paths to suit. In nginx, add_header needs always to apply to error responses.
Related codes
- 400Bad RequestThe server could not understand the request.
- 413Content Too LargeThe request body is bigger than the server allows.
- 414URI Too LongThe address is longer than the server will process.
All status codes · All 4xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.