DevKits
431

Request Header Fields Too Large

4xx Client Error

Last updated:

The server is unwilling to process the request because header fields are too large.

Description

Usually caused by oversized cookies or Authorization headers. Fixing this requires reducing cookie size on the client, not on the server.

When to use

Return 431 for pathological header sizes. Most servers have built-in limits (nginx: 8k, Apache: 8k default).

Specification

RFC 6585

Examples

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

{"error":"Request Header Fields Too Large"}
Node.js (Express)
res.status(431).json({ error: "Request Header Fields Too Large" });
Go (net/http)
w.WriteHeader(http.Status431)
Python (Flask)
return jsonify({"error": "Request Header Fields Too Large"}), 431

Related status codes

All 4xx codes