HTTP 421 Misdirected Request vs 524 A Timeout Occurred
HTTP 421 (Misdirected Request) is a 4xx Client Error response, while 524 (A Timeout Occurred) is a 5xx Server Error response. 421 indicates that the request was directed at a server that is unable to produce a response for the combination of scheme and authority in the URI. 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 request was directed at a server that is unable to produce a response for the combination of scheme and authority in the URI.
When You See It
With HTTP/2 when a connection is reused for a domain the certificate doesn't cover.
How to Fix
Retry the request on a new connection.
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
421 is a 4xx Client Error response, while 524 is a 5xx Server Error response.
HTTP 421: The request was directed at a server that is unable to produce a response for the combination of scheme and authority in the URI.
HTTP 524: Cloudflare-specific. A TCP connection was established but the origin didn't respond with an HTTP response in time.
You encounter 421 when with HTTP/2 when a connection is reused for a domain the certificate doesn't cover.
You encounter 524 when when a request to the origin takes longer than Cloudflare's 100-second timeout.
When to Use Which
For 421 (Misdirected Request): Retry the request on a new connection. For 524 (A Timeout Occurred): Optimize slow endpoints. Move long-running tasks to background jobs.