3xx RedirectionCommonly usedRFC 9110
304Not Modified
Resource has not changed — use the cached version.
What it means
The resource has not been modified since the version specified in the request headers (If-Modified-Since or If-None-Match). The client should use its cached version. This saves bandwidth by avoiding re-sending unchanged content.
When to use it
- ✓Client has a cached version and checks if it is still valid
- ✓API responses with ETags for cache validation
- ✓Static assets with Last-Modified headers
Code Examples
Express — ETag caching
javascript
// Express enables ETags by default
app.get('/data', (req, res) => {
const data = { users: [...] };
// Express automatically sends 304 if ETag matches
res.json(data);
});Don't confuse with
Quick Facts
Code304
CategoryRedirection
SpecRFC 9110
CommonYes
Relevant Headers
ETag
Unique identifier for the current version of the resource
If-None-Match
Request header with cached ETag value
Last-Modified
Date the resource was last changed
If-Modified-Since
Request header with cached date