HTTP

HTTP 304 Not Modified vs 428 Precondition Required

HTTP 304 (Not Modified) is a 3xx Redirection response, while 428 (Precondition Required) is a 4xx Client Error response. 304 indicates that the resource has not been modified since the last request. The client can use its cached copy. In contrast, 428 means that the server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

Description

The resource has not been modified since the last request. The client can use its cached copy.

When You See It

When the browser cache is still valid (If-None-Match / If-Modified-Since headers match).

How to Fix

No fix needed. This saves bandwidth by confirming the cached version is still current.

Description

The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

When You See It

When an API requires optimistic concurrency control via ETags.

How to Fix

Fetch the resource first to get its ETag, then include If-Match in your update request.

Key Differences

1.

304 is a 3xx Redirection response, while 428 is a 4xx Client Error response.

2.

HTTP 304: The resource has not been modified since the last request. The client can use its cached copy.

3.

HTTP 428: The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

4.

You encounter 304 when when the browser cache is still valid (If-None-Match / If-Modified-Since headers match).

5.

You encounter 428 when when an API requires optimistic concurrency control via ETags.

When to Use Which

For 304 (Not Modified): No fix needed. This saves bandwidth by confirming the cached version is still current. For 428 (Precondition Required): Fetch the resource first to get its ETag, then include If-Match in your update request.

Learn More