304 Not Modified
The client asked "has this changed since my copy?" and the answer is no. The server sends headers only and the client reuses what it already has.
What 304 means
A 304 is not an error and, despite sitting in the 3xx range, it does not send you to another URL. It is the short answer to a conditional GET or HEAD: the stored response is still valid, so the server skips the body and the client serves its cached copy.
A server never sends a 304 unprompted. It only appears when the request carried a condition.
How the exchange works
- The first response is a normal 200 that includes a validator:
ETag: "5f2c-61a8b3", aLast-Modifieddate, or both. - When the cached copy needs checking, the client repeats the request with
If-None-Match: "5f2c-61a8b3"(andIf-Modified-Sincewith the date). - The server compares. If nothing changed it answers 304 with no body. Otherwise it sends a 200 with the new content and a new validator.
When both headers are present, If-None-Match decides and If-Modified-Since is ignored. For methods other than GET and HEAD, a failed If-None-Match produces 412 Precondition Failed, not 304.
Headers a 304 has to repeat
A 304 has no body, but it must include any of these headers that the equivalent 200 would have carried: Cache-Control, Content-Location, Date, ETag, Expires and Vary. The cache uses them to refresh the stored response, for example to restart its max-age.
A 304 that leaves out Cache-Control is a common reason for a browser revalidating the same file on every page view.
Why you get 200 when you expected 304
- A hard reload. Ctrl+F5, or "Disable cache" in the developer tools, sends no conditional headers, so the server has to answer 200.
- No validator. The original response had neither
ETagnorLast-Modified, so the client has nothing to ask with. - The ETag keeps changing. Tags derived from a build timestamp, or computed differently on each server behind a load balancer, never match on the next request.
Cache-Control: no-store. Nothing was kept, so there is nothing to revalidate.
The opposite problem, a 304 for content that did change, means the validator is not tied to the content: an ETag built from something that stayed the same, or a deploy that preserved file modification times.
Seeing neither code is normal as well. While a cached response is still fresh, the browser uses it without contacting the server at all.
Using 304 from your own code
- In browsers,
fetch()revalidates behind the scenes. Your code receives a 200 with the cached body, even though the network tab shows a 304. - In a server-side client or script you do the work yourself: store the
ETagwith the body, send it inIf-None-Match, and on a 304 reuse the stored body. Do not try to parse the 304; it is empty. - To force a full response, leave the conditional headers out:
curl -i https://example.com/app.jsalways gets a 200. - To test the server, send the validator by hand:
curl -i -H 'If-None-Match: "5f2c-61a8b3"' https://example.com/app.js.
Crawlers use the same mechanism. Googlebot takes a 304 to mean that the content is unchanged since its last crawl.
304 compared with 200 and 412
| Code | Sent when | Body |
|---|---|---|
| 304 Not Modified | A conditional GET or HEAD finds the cached copy still current | None |
| 200 OK | There was no condition, or the content has changed | The full content |
| 412 Precondition Failed | A condition failed on a method that changes state, such as PUT with If-Match | An error description |
Example 304 response
HTTP/1.1 304 Not Modified
Date: Sat, 14 Nov 2026 10:15:00 GMT
ETag: "5f2c-61a8b3"
Cache-Control: max-age=3600
Vary: Accept-EncodingNo body follows. The cache keeps its stored content, replaces the stored headers with these and treats the copy as fresh for another hour.
Defined in RFC 9110, section 15.4.5.
Questions
Is 304 Not Modified an error?
No. It is the efficient outcome of a cache check: the server confirms that the copy the client already holds is current, and saves sending it again. Nothing needs fixing.
Why do I never see a 304 in my fetch() code?
The browser handles revalidation inside its HTTP cache. When the server answers 304, the browser combines it with the stored response and hands your code a normal 200 with the cached body. You only see a 304 if you set the conditional headers yourself.
Should I use ETag or Last-Modified?
Send both if you can. An ETag is more precise because it changes whenever the content does, while Last-Modified has a resolution of one second. When a request carries both conditions, the server evaluates If-None-Match and ignores If-Modified-Since.
How do I force the server to send the full file?
Make the request without If-None-Match and If-Modified-Since. A hard reload in the browser does that, and so does a plain curl request.