📋
431
Request Header Fields Too Large
!
?

Example HTTP Response

HTTP Response
HTTP/1.1 431 Request Header Fields Too Large
Common Causes
  • Cookie header too large
  • Too many custom headers
  • Excessively long header values
Technical Details

What does this mean?

TMI in the headers! You're sending so much metadata that the server's eyes glazed over. Trim those headers down!

Technical Definition

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

RFC Says

"The 431 (Request Header Fields Too Large) status code indicates that the server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields."

Plain English:

431 means 'Your HTTP headers are too big.' This can happen when you have too many cookies, very large authorization tokens, or numerous custom headers. The server has a limit on total header size (often 8KB) and you've exceeded it.

Common Misinterpretation

If only one specific header is too large, consider mentioning which one in the error message. This often happens with JWT tokens or cookies. Don't confuse this with 413 (payload too large) - 431 is about headers, 413 is about the request body.

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(431).json({
    error: 'Request Header Fields Too Large',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(431, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Request Header Fields Too Large',
    message: 'Your error message here'
  }));
}).listen(3000);