HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

431 Request Header Fields Too Large

Fault: Client
TL;DR

Either an individual header or the total set of headers exceeds the server's limit, frequently caused by oversized or too many cookies.

The server refuses the request because its header fields are too large.

What HTTP 431 Request Header Fields Too Large Means

The server refuses the request because its header fields are too large.

Either an individual header or the total set of headers exceeds the server's limit, frequently caused by oversized or too many cookies.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 431 Request Header Fields Too Large (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 431 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(431).json({ error: 'Request Header Fields Too Large' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Request Header Fields Too Large'), 431

PHP

<?php
http_response_code(431);
header('Content-Type: application/json');
echo json_encode(['error' => 'Request Header Fields Too Large']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 431 Request Header Fields Too Large

Frequently Asked Questions

What does HTTP 431 Request Header Fields Too Large mean?

Either an individual header or the total set of headers exceeds the server's limit, frequently caused by oversized or too many cookies. In short: The server refuses the request because its header fields are too large.

Is 431 Request Header Fields Too Large a client or server error?

431 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.

How do I fix a 431 Request Header Fields Too Large error?

Reduce cookie and header size. Raise large_client_header_buffers (Nginx) or LimitRequestFieldSize (Apache). Avoid storing large data in headers/cookies.

Official Specification

The 431 Request Header Fields Too Large status code is defined in RFC 6585 Section 5.

View the IANA HTTP Status Code Registry →