HTTP

HTTP 405 Method Not Allowed vs 409 Conflict

Both HTTP 405 (Method Not Allowed) and 409 (Conflict) belong to the 4xx Client Error category. 405 indicates that the HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods. Meanwhile, 409 means that the request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.

Description

The HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods.

When You See It

When sending POST to a read-only endpoint, or DELETE to a non-deletable resource.

How to Fix

Check the Allow response header for supported methods. Use the correct HTTP method.

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.

Key Differences

1.

HTTP 405: The HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods.

2.

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

3.

You encounter 405 when when sending POST to a read-only endpoint, or DELETE to a non-deletable resource.

4.

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

When to Use Which

For 405 (Method Not Allowed): Check the Allow response header for supported methods. Use the correct HTTP method. For 409 (Conflict): Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency.

Learn More