The HTTP 304 is a response code servers use when they don’t see a need to transfer a resource.
304 Not Modified is a response to conditional HEAD and GET requests. The most common use-case is caching. For example, a browser can request a CSS file only if it has changed since the previous request. Otherwise, a browser returns a cached copy stored locally.
Clients and servers use two sets of headers to enable this:
If-Modified-Since- date and time when the resource was last updated
If-None-Match- a unique hash identifying the resource
Servers usually include
ETag headers in their responses (both can be used interchangeably). When clients send subsequent requests to the server, they include the value in those headers in the
If-None-Match headers, respectively.
When used in combination,
If-None-Match takes precedence over
If-Modified-Since because it’s more accurate to compare and track hashes rather than timestamps.
GET /voodoo.css HTTP/2 If-Modified-Since: Sun, 27 Jan 2021 08:28:37 GMT If-None-Match: "1fd5d0a5-30d"
If the file hasn’t been modified, the server returns
304 Not Modified without a body.
HTTP/2 304 Not Modified
304 Not Modified is the equivalent of the
200 OK response if it weren’t for the conditional request.
No spyware, no promotional emails, or keyword-stuffed junk. I will only send you a single email when I've got something interesting to say. Unsubscribe anytime.
You can also subscribe to the Atom feed (it's like RSS, but better).