304Not Modified
Your cached copy is still current. Use it; no body is sent.
How you get a 304
The browser has this file cached and sends its ETag along, asking “still the same?”. The app compares, finds no change, and the app sends 304 with no body. The browser uses its own copy.
Who sends itApp · CDN · Proxy
- Browser
- CDN
- Proxy
- App
- DB
Whichever box holds the current version: typically the app or the proxy serving static files, or the CDN when it can answer from its own cache.
In short
What a 304 Not Modified means
A 304 Not Modified is the answer to a question, not a failure. The browser already has a copy of the resource and asks whether it is still current, by sending the copy's ETag in If-None-Match or its date in If-Modified-Since. If nothing has changed, the server answers 304 with headers only and the browser reuses what it has. The saving is the body: a large file is confirmed with a few hundred bytes. Whichever box knows the current version can answer, so a CDN often does it without contacting the application. A 304 only ever follows a conditional request. If you see one where you expected fresh content, the problem is usually an ETag that did not change when the content did.
When you see a 304
1The browser is revalidating a cached file that has passed its freshness lifetime.
How to check: The request carries If-None-Match or If-Modified-Since. Send one yourself to reproduce it.
curl -sI https://example.com/app.js -H 'If-None-Match: "abc123"'2A reload: browsers revalidate the page's resources when the user refreshes.
How to check: A hard reload skips the conditional headers and gets 200 instead.
3Content changed but the ETag did not, so users keep the old version.
How to check: Compare the ETag before and after a deploy. If it is the same, the validator is wrong.
curl -sI https://example.com/app.js | grep -i etag
Retry or not?
Nothing to retry
Headers that matter
- ETag
- The version label of the resource. The 304 repeats it so the cache can confirm what it holds.
- If-None-Match
- Request header. Carries the ETag of the cached copy and turns the GET into “only if changed”.
- Cache-Control
- A 304 can refresh the cached copy's lifetime, so the browser stops asking for a while.
In the real world
RFC vs real deployments
RFC 9110 files 304 under redirects, although it redirects nowhere: it points the client at its own cache. The usual trouble is validators. Servers that build ETags from file details can produce a different ETag on each machine, so a fleet behind a load balancer answers 200 where 304 was possible. The opposite also happens: an ETag that stays the same across a deploy keeps old content alive.
Seen in a real outage
How long caches may keep things decides how much traffic reaches the servers behind them. GitHub cut a cache lifetime from 12 hours to 2 on a quiet Saturday; on Monday the database behind it overloaded.
Your turn
Which code is it?
After a deploy, some users still run the old app.js. The network tab shows the request for it returning 304 in a few milliseconds. What is the most likely cause?
304 questions
- Is 304 Not Modified an error?
- No. It means the copy in the browser's cache is still current, so the server skipped sending the body. It makes pages load faster.
- Who sends a 304?
- Whichever server can confirm the version: typically the app or the web server for static files, or the CDN from its own cache.
- Why do I get 304 instead of 200?
- Because the request was conditional. The browser sent If-None-Match or If-Modified-Since from a cached copy, and the server found nothing newer.
Sources: RFC 9110: 304 Not Modified (section 15.4.5) ↗ · RFC 9110: If-None-Match (section 13.1.2) ↗ · RFC 9111: HTTP Caching, validation (section 4.3) ↗ · Report a problem
Diagrams are our own simulations. All wording is original and paraphrases the linked sources.
Practise this in the DNS / HTTP track
Two-minute animated lessons, then boss fights from real outages. Free, no account needed.