HTTPfy

431 Request Header Fields Too Large

The request headers are too large, either one header or all of them together.

431 at a glance

Code
431
Name
Request Header Fields Too Large
Class
4xx Client error
Status
IANA-registered standard code
Defined in
RFC 6585, Section 5
Cacheable by default
No by default. Caches store it only when the response carries explicit freshness (Cache-Control max-age, s-maxage or Expires).

What 431 means

431 Request Header Fields Too Large (RFC 6585) means the server refuses to process the request because its headers are over a size limit. The usual culprit is cookies: an app that keeps adding cookies, or many apps sharing a parent domain, until the Cookie header exceeds the limit.

What typically causes a 431

  • Node.js rejects headers larger than --max-http-header-size (16 KB by default) with 431.
  • Too many or too large cookies on a shared domain (e.g. many apps on *.example.com), or huge JWTs in cookies.
  • nginx reports the same problem as "400 Request Header Or Cookie Too Large" instead of 431.
  • Long Referer or custom headers added by proxies.

Fix it on the server

  • Reduce cookie size or scope cookies to specific hosts and paths; store sessions server-side.
  • If you must, raise limits: Node --max-http-header-size, nginx large_client_header_buffers, Apache LimitRequestFieldSize.

Fix it as a client or visitor

  • Clear cookies for the site (and its parent domain); in development, clear localhost cookies, which collect from many projects.

Headers that go with 431

HeaderRole
CookieMost frequent oversized header.

Example response

HTTP/1.1 431 Request Header Fields Too Large
Connection: close
Content-Length: 0

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.