HTTP

HTTP 421 Misdirected Request vs 504 Gateway Timeout

HTTP 421 (Misdirected Request) is a 4xx Client Error response, while 504 (Gateway Timeout) 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, 504 means that the server, acting as a gateway or proxy, did not receive a timely response from the upstream server.

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

The server, acting as a gateway or proxy, did not receive a timely response from the upstream server.

When You See It

When an upstream server is too slow to respond within the proxy's timeout window.

How to Fix

Increase proxy timeout settings. Optimize upstream server performance. Check for long-running queries.

Key Differences

1.

421 is a 4xx Client Error response, while 504 is a 5xx Server Error response.

2.

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.

3.

HTTP 504: The server, acting as a gateway or proxy, did not receive a timely response from the upstream server.

4.

You encounter 421 when with HTTP/2 when a connection is reused for a domain the certificate doesn't cover.

5.

You encounter 504 when when an upstream server is too slow to respond within the proxy's timeout window.

When to Use Which

For 421 (Misdirected Request): Retry the request on a new connection. For 504 (Gateway Timeout): Increase proxy timeout settings. Optimize upstream server performance. Check for long-running queries.

Learn More