HTTP 304 Not Modified vs 415 Unsupported Media Type
HTTP 304 (Not Modified) is a 3xx Redirection response, while 415 (Unsupported Media Type) 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, 415 means that the server refuses to accept the request because the Content-Type is not supported.
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 refuses to accept the request because the Content-Type is not supported.
When You See It
When sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.
How to Fix
Set the correct Content-Type header matching the data format you're sending.
Key Differences
304 is a 3xx Redirection response, while 415 is a 4xx Client Error response.
HTTP 304: The resource has not been modified since the last request. The client can use its cached copy.
HTTP 415: The server refuses to accept the request because the Content-Type is not supported.
You encounter 304 when when the browser cache is still valid (If-None-Match / If-Modified-Since headers match).
You encounter 415 when when sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.
When to Use Which
For 304 (Not Modified): No fix needed. This saves bandwidth by confirming the cached version is still current. For 415 (Unsupported Media Type): Set the correct Content-Type header matching the data format you're sending.