Start free · Free tools · Fair usage limits
Browse Tools

Categories

Custom AI Solutions – AI2Flows
LIVE NEWS
Loading latest AI & SEO news…
Home›Tools›HTTP Status Codes Reference›HTTP 431 Request Header Fields Too Large
4xx Client Error

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 code431
NameRequest Header Fields Too Large
Class4xx Client Error
Defined inRFC 6585
Cacheable by defaultNo, unless Cache-Control says so
Safe to retry automatically?No: change the request first
Related headersCookie, 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?

  1. Clear cookies for the site (or localhost during development).
  2. Store less in cookies; keep sessions server-side.
  3. 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.

Frequently asked questions

Why does localhost return 431 in development?
Cookies from many local projects share the localhost domain and pile up. Clear cookies for localhost.
How do I raise the header limit in Node.js?
Start Node with --max-http-header-size=32768 (bytes) or set maxHeaderSize when creating the server.
Is 431 a client or server error?
431 is in the 4xx class, so it is classed as a client error: the request needs to change before it can succeed.