304 Not Modified: what it means and how conditional requests work

A 304 is not an error: it means the cached copy is still good. How ETag and Last-Modified revalidation works, why a 304 can go wrong, and how to debug stale content.

· 7 min read · By the Spot Downtime team

A 304 Not Modified is the one 3xx status that is not a redirect and not a problem. It is the server saying: the copy you already have is still current, so I am not sending the body again. It saves bandwidth and makes repeat visits faster.

People search for it because they see it in browser dev tools, in access logs or in a monitoring report and wonder whether something is broken. Usually nothing is. This post explains how it works, when it does go wrong, and how to debug stale or never-updating content.

How a 304 comes about

When a browser or CDN has a cached response that has expired (or must be revalidated), it does not have to download the file again. It asks the server whether the file changed, using a conditional request. There are two validators:

  • ETag / If-None-Match. The first response carries an ETag header, an opaque identifier for that version. The client sends it back in If-None-Match.
  • Last-Modified / If-Modified-Since. The first response carries a Last-Modified date. The client sends it back in If-Modified-Since.
http
GET /app.css HTTP/1.1
Host: www.example.com
If-None-Match: "5d8c72a5edda8"
If-Modified-Since: Tue, 24 Nov 2026 09:12:00 GMT

HTTP/1.1 304 Not Modified
ETag: "5d8c72a5edda8"
Cache-Control: max-age=3600

A 304 response has no body. The client reuses its stored copy and, per the HTTP caching rules, updates the stored headers from the 304 (for example a fresh Cache-Control or Expires). If the file did change, the server answers a normal 200 with the new body and a new validator.

Reproduce it with curl

First, fetch the headers and note the validators:

bash
curl -sI https://www.example.com/app.css
# ETag: "5d8c72a5edda8"
# Last-Modified: Tue, 24 Nov 2026 09:12:00 GMT

Then send them back and see whether you get a 304:

bash
curl -si https://www.example.com/app.css \
  -H 'If-None-Match: "5d8c72a5edda8"' -o /dev/null -w '%{http_code}\n'

A 304 means revalidation works. A 200 with the full body means the server ignores conditional headers (or the ETag changes on every request), which costs you bandwidth and speed. If neither ETag nor Last-Modified appears in the first response, the client has nothing to revalidate with, and every expired entry is downloaded in full.

Common reasons a 304 is not what you want

  • Users see old content. The browser is allowed to reuse its copy without asking at all while max-age has not run out. A 304 only happens after that. If you deploy a changed file at the same URL with a long max-age, visitors keep the old one until it expires. Fix it with versioned file names (app.3f9a1c.css) for assets and a short max-age or no-cache for HTML.
  • ETag differs between servers. Apache's default ETag includes the file's inode, which differs per machine. Behind a load balancer the validator never matches, so you get 200s instead of 304s. Use FileETag MTime Size in Apache, or rely on Last-Modified only.
  • Compression changes the ETag. Some servers and proxies weaken or rewrite the ETag when gzip is applied (a W/ prefix marks a weak validator). A mismatch between layers breaks revalidation.
  • A 304 for something that did change. If your application sets a constant Last-Modified or a hard-coded ETag, every conditional request looks unchanged and clients never get the update. Generate validators from the content.
  • Dynamic pages answering 304 incorrectly. Some frameworks compute an ETag from the response body and answer 304 when it matches. If the body leaves out per-user data, a user can be told their (different) cached copy is fine. Pair conditional handling with Vary and Cache-Control: private for personalised pages.

Rules a correct 304 follows

  • It has no message body.
  • It includes the headers a 200 would have used to decide caching: ETag, Cache-Control, Expires, Vary, Content-Location, Date.
  • It only answers GET and HEAD requests that were conditional. A 304 to an unconditional request is a server bug.
  • If both If-None-Match and If-Modified-Since are sent, If-None-Match takes precedence.

For unsafe methods such as PUT and DELETE, a failed precondition is a different status: 412 Precondition Failed.

Setting it up in nginx

Static files in nginx get ETag and Last-Modified automatically and conditional requests work with no extra config. To control how long clients may skip the check entirely:

nginx
location /assets/ {
    expires 1y;
    add_header Cache-Control "public, immutable";
}

location / {
    # HTML: always revalidate, so 304s keep it cheap
    add_header Cache-Control "no-cache";
}

no-cache does not mean “do not store”. It means store, but revalidate before every use, which is exactly the job a 304 does.

304 and uptime monitoring

An uptime check normally sends a plain request without validators, so it should see 200, not 304. If a monitor does report 304, something is adding conditional headers or a proxy is answering on its own. Treat 304 as a success status, because it proves the server responded and the cache is working, but check why your monitor sees it.

What a 304 cannot tell you is whether the page is actually correct. A site that serves a cached copy of a broken page also answers 304 happily. A website monitor with a keyword or content check on the real response body covers that gap.

HTTP header checkerLook at the ETag, Last-Modified and Cache-Control headers a URL returns.

Quick checklist

A 304 is fine. If content looks stale, check Cache-Control max-age first, then whether the ETag is stable across servers, then whether assets use versioned URLs. If you never get 304s, the server is not sending validators.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading