MockFoxAdvertise

HTTP 431 Request Header Fields Too Large

Updated Free mock REST & WebSocket APIs

HTTP 431 Request Header Fields Too Large — The server refuses the request because a header — or all headers together — is too large.

Class
4xx Client Error
Defined in
RFC 6585
Official
Yes (IANA registry)
Cacheable by default
No (unless Cache-Control/Expires say so)
Safe to retry
Not without changing the request

Try it: get a real 431 response

Our test endpoint answers every request with 431 Request Header Fields Too Large.

curl -i https://mockfox.dev/api/status/431

Use it in tests, health-check monitors or to see how your client handles a 431. Add ?delay=2000 to slow it down.

What does HTTP 431 mean?

Most often caused by bloated cookies: too many or too large cookies on a domain (analytics, A/B testing, oversized session or JWT cookies). Node.js limits total header size to 16 KB by default (--max-http-header-size), nginx to 4×8 KB buffers. Clearing the site's cookies fixes it for users; developers should slim cookies or raise the limit. nginx reports this as 400 "Request Header Or Cookie Too Large" (494 internally).

How to fix 431

  1. Visitors: Reload the page, check the address for typos, and clear the site's cookies. If it persists, the site owner needs to fix it.
  2. Developers: Read the response body and server logs for details, fix the request (method, headers, body, credentials) and return a clear error message to clients.

Example 431 response

HTTP/1.1 431 Request Header Fields Too Large
Content-Type: application/json

{"status":431,"error":"Request Header Fields Too Large"}

4xx Client Error: The request contains an error or can't be fulfilled — fix the request before retrying. See the full list of HTTP status codes.

Related status codes

Related tools

Frequently asked questions

What does HTTP 431 Request Header Fields Too Large mean?

The server refuses the request because a header — or all headers together — is too large.

Is 431 a client or a server error?

431 is a 4xx code, so it signals a problem with the request (as seen by the server). Retrying the identical request usually gives the same result.

Where is 431 defined?

In RFC 6585. It's listed in the IANA HTTP Status Code Registry.

How can I test how my app handles a 431?

Call https://mockfox.dev/api/status/431 — it responds with 431 to any method, with CORS enabled. Add ?delay=2000 to simulate a slow response.