431 Request Header Fields Too Large
HTTP response status code 431 Request Header Fields Too Large is returned by the server to indicate that the HTTP headers are too large. This may indicate the total size used by all HTTP headers or instead, only that certain HTTP headers are too big.
When the 431 Request Header Fields Too Large status code is received, the server is refusing to process the HTTP request because there is too much data specified by the HTTP headers.
Depending on the server, this may refer to the total length of HTTP headers combined or instead, specific ones. In either case, the client may have the option to remove one or more HTTP headers and try the HTTP request again. One possible solution for limiting the number of HTTP headers is to cut or reduce the Cookies that are being transmitted.
Search engines like Google will not index a URL with 431 Request Header Fields Too Large response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.
In the example, the client requests a resource and the server responds with the 431 Request Header Fields Too Large status code because the combination of two very large cookie values exceeds the maximum limit set by the server for HTTP headers.
GET /tech-news HTTP/1.1 Host: www.example.ai Cookie: first_cookie=<very_long>; second_cookie=<long again!>
HTTP/1.1 431 Request Header Fields Too Large Content-Type: text/html Content-Length: 183 <html> <head> <title>Request Headers Too Long</title> </head> <body> <p>Your request headers are too long. Try retrying the request without cookies.</p> </body> </html>
Apache HttpComponents Core
The 431 Request Header Fields Too Large status code is a client error that is sent by the server when the client sends an HTTP request with too much data in the HTTP headers. If the HTTP request can be reduced in size while still making sense, then the HTTP request can be resubmitted with the smaller sized HTTP headers.