HTTP 431 Request Header Fields Too Large vs 524 A Timeout Occurred
HTTP 431 (Request Header Fields Too Large) is a 4xx Client Error response, while 524 (A Timeout Occurred) 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, 524 means that cloudflare-specific. A TCP connection was established but the origin didn't respond with an HTTP response in time.
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. A TCP connection was established but the origin didn't respond with an HTTP response in time.
When You See It
When a request to the origin takes longer than Cloudflare's 100-second timeout.
How to Fix
Optimize slow endpoints. Move long-running tasks to background jobs.
Key Differences
431 is a 4xx Client Error response, while 524 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 524: Cloudflare-specific. A TCP connection was established but the origin didn't respond with an HTTP response in time.
You encounter 431 when when cookies accumulate to an excessive size, or a single header (like Authorization) is too long.
You encounter 524 when when a request to the origin takes longer than Cloudflare's 100-second timeout.
When to Use Which
For 431 (Request Header Fields Too Large): Reduce header sizes. Clear excessive cookies. Use shorter tokens. For 524 (A Timeout Occurred): Optimize slow endpoints. Move long-running tasks to background jobs.