HTTP

HTTP 409 Conflict vs 421 Misdirected Request

Both HTTP 409 (Conflict) and 421 (Misdirected Request) belong to the 4xx Client Error category. 409 indicates that the request conflicts with the current state of the server. Often due to concurrent modification or business rule violations. Meanwhile, 421 means 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.

Description

The request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.

When You See It

When trying to create a resource that already exists, or updating a resource that was modified by another request.

How to Fix

Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency.

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.

Key Differences

1.

HTTP 409: The request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.

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.

You encounter 409 when when trying to create a resource that already exists, or updating a resource that was modified by another request.

4.

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

When to Use Which

For 409 (Conflict): Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency. For 421 (Misdirected Request): Retry the request on a new connection.

Learn More