HTTP 431 Request Header Fields Too Large vs 521 Web Server Is Down
HTTP 431 (Request Header Fields Too Large) is a 4xx Client Error response, while 521 (Web Server Is Down) is a 5xx Server Error response. 431 indicates that the server refuses to process the request because an individual header field or all headers collectively are too large. In contrast, 521 means that cloudflare-specific. The origin server refused the connection.
Description
The server refuses to process the request because an individual header field or all headers collectively are too large.
When You See It
When cookies accumulate to an excessive size, or a single header (like Authorization) is too long.
How to Fix
Reduce header sizes. Clear excessive cookies. Use shorter tokens.
Description
Cloudflare-specific. The origin server refused the connection.
When You See It
When Cloudflare can't establish a TCP connection to the origin server.
How to Fix
Check that the origin server is running and the firewall allows Cloudflare IPs.
Key Differences
431 is a 4xx Client Error response, while 521 is a 5xx Server Error response.
HTTP 431: The server refuses to process the request because an individual header field or all headers collectively are too large.
HTTP 521: Cloudflare-specific. The origin server refused the connection.
You encounter 431 when when cookies accumulate to an excessive size, or a single header (like Authorization) is too long.
You encounter 521 when when Cloudflare can't establish a TCP connection to the origin server.
When to Use Which
For 431 (Request Header Fields Too Large): Reduce header sizes. Clear excessive cookies. Use shorter tokens. For 521 (Web Server Is Down): Check that the origin server is running and the firewall allows Cloudflare IPs.