HTTP

HTTP 304 Not Modified vs 429 Too Many Requests

HTTP 304 (Not Modified) is a 3xx Redirection response, while 429 (Too Many Requests) 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, 429 means that the user has sent too many requests in a given time (rate limiting). The response should include a Retry-After header.

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 user has sent too many requests in a given time (rate limiting). The response should include a Retry-After header.

When You See It

When hitting API rate limits or making too many requests too quickly.

How to Fix

Check the Retry-After header. Implement exponential backoff. Consider caching responses.

Key Differences

1.

304 is a 3xx Redirection response, while 429 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 429: The user has sent too many requests in a given time (rate limiting). The response should include a Retry-After header.

4.

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

5.

You encounter 429 when when hitting API rate limits or making too many requests too quickly.

When to Use Which

For 304 (Not Modified): No fix needed. This saves bandwidth by confirming the cached version is still current. For 429 (Too Many Requests): Check the Retry-After header. Implement exponential backoff. Consider caching responses.

Learn More