HTTP 431 Request Header Fields Too Large
HTTP 431 Request Header Fields Too Large means the server rejects the request because its headers are too big, either one header or all of them together.
Quick answer
HTTP 431 Request Header Fields Too Large means the server rejects the request because its headers are too big, either one header or all of them together. The usual culprit is an oversized Cookie header built up from too many or too large cookies.
Last updated · Maintained by FreeAIToolz · How we test
What does HTTP 431 Request Header Fields Too Large mean?
Servers cap header size (Node.js defaults to 16 KB total; Nginx uses large_client_header_buffers). Large JWTs in cookies, tracking cookies and localhost cookies shared across many dev projects often push requests over the limit.
| Status code | 431 |
|---|---|
| Name | Request Header Fields Too Large |
| Class | 4xx Client Error |
| Defined in | RFC 6585 |
| Cacheable by default | No, unless Cache-Control says so |
| Safe to retry automatically? | No: change the request first |
| Related headers | Cookie, Authorization |
What causes HTTP 431?
- Too many or too large cookies for the domain (especially localhost).
- Large JWTs or auth headers.
- Long Referer URLs.
How do I fix HTTP 431?
- Clear cookies for the site (or localhost during development).
- Store less in cookies; keep sessions server-side.
- Raise limits if needed: Node --max-http-header-size, Nginx large_client_header_buffers.
What should a client do after HTTP 431?
Reduce header size (clear cookies) and retry.
Does HTTP 431 affect SEO?
Googlebot does not send cookies, so it rarely triggers 431.
Example 431 response
HTTP/1.1 431 Request Header Fields Too Large
Date: Mon, 01 Dec 2026 12:00:00 GMT
Content-Type: application/json
{"error":{"status":431,"message":"Request Header Fields Too Large"}} How to return 431 Request Header Fields Too Large in code
Express (Node.js)
res.status(431).json({ error: 'Request Header Fields Too Large' }); Next.js route handler
return Response.json({ error: 'Request Header Fields Too Large' }, { status: 431 }); FastAPI (Python)
raise HTTPException(status_code=431, detail="Request Header Fields Too Large") PHP
http_response_code(431); Nginx
location = /example {
return 431;
} Other 4xx status codes
The request contains an error or cannot be fulfilled as sent. Fix the request before retrying.
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Content Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I'm a teapot
- 421 Misdirected Request
- 422 Unprocessable Content
- 423 Locked
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 451 Unavailable For Legal Reasons
- 499 Client Closed Request
Frequently asked questions
Why does localhost return 431 in development?
How do I raise the header limit in Node.js?
Is 431 a client or server error?
Related
- 400 Bad Request HTTP 400 Bad Request means the server cannot process the request because of a client error, such as malformed .
- 413 Content Too Large HTTP 413 Content Too Large (formerly Payload Too Large or Request Entity Too Large) means the request body is .
- 414 URI Too Long HTTP 414 URI Too Long means the requested URL is longer than the server will process.
- Open the HTTP Status Codes Reference → Free, no signup.