HTTP 431 Request Header Fields Too Large

Status code 431 · Class 4xx

HTTP

Request Header Fields Too Large

Also searched as: error 431, HTTP 431, request header fields too large

HTTP request chain from browser through CDN and proxy to the origin server
HTTP errors: find which hop in the request chain failed and read its logs.

What it means

The server refused the request because its headers, almost always the cookies, are too large. It typically appears on sites you have used for a long time or on localhost during development where many apps set cookies on the same host.

Applies to: All browsers, Node.js, nginx, REST APIs

How to fix HTTP 431 Request Header Fields Too Large

  1. Clear cookies for the site (or for 'localhost' during development) and reload
  2. Try a private window to confirm cookies are the cause
  3. Remove extensions that add large custom headers
  4. If you own the site: reduce cookie count and size; store session data on the server instead of in cookies
  5. If you own a Node.js app: the default maximum header size is limited; you can raise it with '--max-http-header-size' if large headers are legitimate
  6. If you own the site behind a proxy: align header buffer limits across CDN, proxy and app

Why it happens

RFC 6585 defines 431 for header sections that exceed the server's limit. Accumulated cookies from many subdomains or apps on the same host, and long auth tokens in headers, are the usual causes.

FAQ

Why do I get 431 on localhost?

Several development apps share the 'localhost' cookie jar. Clear localhost cookies in your browser and the error goes away.

Related errors

Source: IANA HTTP Status Code Registry · fixes written and reviewed by the editors (see our editorial policy)

Last updated: