DevToolsmith

HTTP 431 Request Header Fields Too Large

HTTP 431 Request Header Fields Too Large means the request headers, often cookies, are too large for the server. The request contains an error or can’t be fulfilled. Retrying unchanged won’t help.

Class
4xx Client error
Standard
RFC 6585
Cacheable by default
No
Safe to retry
No
Go constant
http.StatusRequestHeaderFieldsTooLarge

What HTTP 431 means

Usually caused by cookies: a site that keeps adding cookies can push the Cookie header past the server limit (often 8 KB). On localhost it is common because many dev projects set cookies on the same host. Huge JWTs in Authorization can do it too.

How to fix a 431 error

  • Clear the cookies for the site (in DevTools: Application → Cookies).
  • Node.js limits headers to 16 KB by default; raise it with --max-http-header-size.

Retrying

No. Fix the request first; sending it again unchanged will get the same response.

Example response

HTTP/1.1 431 Request Header Fields Too Large
Date: Wed, 21 Oct 2026 10:30:00 GMT
Content-Type: application/json

How to return 431

Node.js (Express)
res.status(431).json({ error: 'Request Header Fields Too Large' });
Python (FastAPI)
from fastapi import HTTPException

raise HTTPException(status_code=431, detail="Request Header Fields Too Large")
Go (net/http)
http.Error(w, http.StatusText(http.StatusRequestHeaderFieldsTooLarge), http.StatusRequestHeaderFieldsTooLarge)
nginx
location /private/ {
    return 431;
}

Related status codes

Other 4xx status codes

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 · 424 Failed Dependency · 425 Too Early · 426 Upgrade Required · 428 Precondition Required · 429 Too Many Requests · 444 No Response · 451 Unavailable For Legal Reasons · 499 Client Closed Request

See the full list of HTTP status codes.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What does HTTP 431 Request Header Fields Too Large mean?

HTTP 431 Request Header Fields Too Large means the request headers, often cookies, are too large for the server. Usually caused by cookies: a site that keeps adding cookies can push the Cookie header past the server limit (often 8 KB). On localhost it is common because many dev projects set cookies on the same host. Huge JWTs in Authorization can do it too.

How do I fix HTTP 431?

Clear the cookies for the site (in DevTools: Application → Cookies). Node.js limits headers to 16 KB by default; raise it with --max-http-header-size.