What does HTTP 431 mean?
The request headers, or a single header, are too large. Almost always caused by too many or too large cookies on a domain — for example tracking cookies piling up, or a large session stored in a cookie.
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 431 error
- Oversized cookies.
- Very long
Refereror custom headers.
How to fix 431 Request Header Fields Too Large
- Clear cookies for the site.
- Store sessions server-side and keep cookies small.
- Raise
large_client_header_buffers(Nginx) if headers are legitimately large.
431 and SEO
Crawlers send few cookies, so they rarely see 431.
Example response
HTTP/1.1 431 Request Header Fields Too Large
How to return a 431 response
Node.js (Express)
res.status(431).json({ error: 'Request Header Fields Too Large' });PHP
http_response_code(431);Python (Flask)
return {'error': 'Request Header Fields Too Large'}, 431Go (net/http)
w.WriteHeader(431)nginx
return 431;
Related status codes
- 400 Bad Request — The server cannot process the request because it is malformed.
- 413 Content Too Large — The request body is larger than the server allows.
- 414 URI Too Long — The URL is longer than the server is willing to process.
Check which status code a URL returns with the HTTP header checker.