What is 304?

HTTP Status Code 304: Not Modified

The HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources. It is an implicit redirection to a cached resource. This happens when the request method is GET or HEAD, and the request is conditional based on an If-Modified-Since or If-None-Match header.

In essence, the server is telling the client "The resource you are requesting hasn't changed since the last time you downloaded it. Use your cached version."

Key aspects of a 304 response:

  • No Body: A 304 response must not contain a message body (i.e., no content). The headers can be provided to inform the client about updating its cache concerning this resource.

  • Caching: This response is primarily used for caching mechanisms. It saves bandwidth and processing resources on both the client and server side.

  • Conditional Requests: A 304 status code is always generated in response to a conditional request. These requests utilize headers like If-Modified-Since or If-None-Match to check if the resource has been updated.

  • Response Headers: The server can include headers (e.g., Date, Cache-Control, Expires, ETag) in a 304 response, these headers are used to update the client's cache entry.

  • Not an Error: 304 is not an error. It is a successful response indicating the client should use its cached resource. It means that the client's cached version of the resource is still valid.

  • Conditional GET: 304 is a core part of the conditional GET process.

In summary, the 304 Not Modified response is a mechanism for efficient resource retrieval, leveraging client-side caching to reduce server load and improve application performance.