HTTP 304 Not Modified answers a conditional request: the client already has a copy of the resource, it asks “has this changed?”, and the server replies that it has not. The reply contains only headers, so it is tiny. It is defined in RFC 9110, section 15.4.5.
How the exchange works
- The first response carries a validator, an
ETag(a fingerprint of the content) and/orLast-Modified.
HTTP/1.1 200 OK
ETag: "33a64df5"
Last-Modified: Sun, 25 Oct 2026 08:00:00 GMT
Cache-Control: max-age=0, must-revalidate
- The next time, the browser repeats the request with the validator:
GET /app.css HTTP/1.1
If-None-Match: "33a64df5"
If-Modified-Since: Sun, 25 Oct 2026 08:00:00 GMT
- If the file did not change, the server answers
304 Not Modifiedwith no body, and the browser uses its copy. If it changed, the server answers 200 with the new body and a newETag.
You can try it with curl: curl -I -H 'If-None-Match: "33a64df5"' https://example.com/app.css shows 304 when the tag matches. Convert a request like that with the curl converter when you need to send it from code.
Why this matters
For a large file that rarely changes, a 304 saves the whole download. It also keeps a page lively: the check costs a round trip but no data. For files that never change under one name (a build output with a hash in the file name), the best answer is not a 304 but a long Cache-Control: max-age with immutable, which removes the round trip altogether.
What a correct 304 contains
The server must send the same headers that matter for caching as it would with the 200 (Cache-Control, ETag, Expires, Vary, Content-Location). If a 304 comes back without them, caches may forget their validators and the next request is a full download. A frequent bug is a framework that sends a 304 without the Cache-Control of the file.
When 304 does not happen
- No validator: the file has no
ETagorLast-Modified. Static servers add them by default, and application servers often do not. - An ETag that changes on every request, for instance if it is generated from the time or from a counter.
- Several servers behind a load balancer that compute different
ETagvalues for the same file (an old Apache setup built the tag from the inode number, which differs by machine). - The browser was told not to cache:
Cache-Control: no-storeremoves the stored copy, so there is nothing to ask about. - DevTools with “Disable cache” ticked, which sends the request without validators.
Reading it in DevTools
In the Network panel, a 304 shows a status of 304 and a small size, while “(disk cache)” or “(memory cache)” means that the browser did not ask the server at all. A 304 is not a redirect even though it is in the 3xx range. The HTTP status codes tool explains each code in the 3xx range; open the example above for the wording and the RFC reference, and read 302 and 301 for the redirects.
Frequently asked questions
Is 304 an error?
No. It is a success of the cache: the browser asked whether its copy was still valid and the server said yes, without sending the file again. A page full of 304 responses is a healthy page.
Why do I never get a 304 for a file?
The response has neither an ETag nor a Last-Modified header, so the browser has nothing to ask with. Another cause is a server that builds a new ETag for every request, for example from a timestamp, or a proxy that strips the header.
What is the difference between a 304 and a response served from cache?
From cache means the browser did not contact the server at all, because the copy was still fresh (Cache-Control: max-age). A 304 means it did contact the server to check, and got a very small answer. A fresh copy is the faster of the two.
Can a 304 have a body?
No. A 304 response has no message body. If you see content, it is coming from the cache, not from the response.
More in this reference
- HTTP 301 Moved Permanently: redirects, caching and SEO
- HTTP 302 Found: temporary redirects, and when to use 303 or 307 instead
- HTTP 400 Bad Request: the common causes and how to find the bad part
- HTTP 401 Unauthorized: missing or invalid credentials, and 401 vs 403
- HTTP 403 Forbidden: why access is refused and how to fix it
- HTTP 404 Not Found: causes, how to debug it and what to return instead
- HTTP 429 Too Many Requests: what it means and how to handle it
- HTTP 500 Internal Server Error: how to find the cause and what to tell users
- HTTP 502 Bad Gateway: finding the broken link between the proxy and the app
- HTTP 503 Service Unavailable: maintenance pages, overload and Retry-After
- HTTP 504 Gateway Timeout: why the proxy gave up waiting, and the timeouts to check