304 Not Modified means: A conditional GET succeeded in the sense that the cached copy is still fresh: the resource has not changed since the version identified by If-None-Match or If-Modified-Since. The response carries no body — the client reuses its cache. Redirection 3xx codes tell the client the resource lives elsewhere, or that a cached copy is still valid. The family splits along two axes: permanent versus temporary, and method-preserving versus method-rewriting. Picking the wrong member causes duplicate submissions, lost POST bodies or stale SEO signals. In practice you will meet 304 when a browser revalidates a cached asset with an etag; an api client polls with if-none-match to avoid re-downloading unchanged data; a cdn revalidates stale content against the origin. On the client side, send validators (ETag/Last-Modified) on revalidation and reuse the cached body on 304; never treat 304 as an error or as an empty resource. On the server side, compare conditional headers correctly and emit 304 without a body; keep ETags stable across servers or use weak validators behind load balancers.
When 304 happens
- A browser revalidates a cached asset with an ETag
- An API client polls with If-None-Match to avoid re-downloading unchanged data
- A CDN revalidates stale content against the origin
How to fix it
On the client
Send validators (ETag/Last-Modified) on revalidation and reuse the cached body on 304; never treat 304 as an error or as an empty resource.
On the server
Compare conditional headers correctly and emit 304 without a body; keep ETags stable across servers or use weak validators behind load balancers.
Should you retry?
Not an error — reuse your cached copy; no body will arrive.
Debugging steps
When 304 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Inspect the Location header and count redirect hops: chains and loops are the usual culprits, and DevTools shows whether the browser rewrote your method on the way. For this code specifically, check whether the most common trigger applies to your situation: a browser revalidates a cached asset with an etag. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.
Notes & gotchas
304 responses must not carry a body but may update cached headers; inconsistent ETags across load-balanced backends are the most common reason revalidation silently stops working.
Examples
HTTP/1.1 304 Not Modified
ETag: "v2-abc123"
curl -i -H 'If-None-Match: "v2-abc123"' https://api.example.com/v1/resource const res = await fetch("https://api.example.com/v1/resource");
if (res.status === 304) {
// Not Modified: no body arrives — reuse cached state or treat as success.
return;
} import requests
res = requests.get("https://api.example.com/v1/resource", timeout=10)
if res.status_code == 304:
pass # Not Modified: no body — reuse cached state / treat as success Frequently asked questions
Does 304 save bandwidth?
Yes — headers only, no body. Combined with far-future Expires for immutable assets, it is the backbone of efficient web caching.
Why do I get 200 instead of 304?
Validators must match: ETags differing per backend, gzip changing the ETag, or missing If-None-Match all defeat revalidation. Use consistent or weak ETags.
Which redirect code should I use?
Permanent move: 301 (GET) or 308 (method-preserving). Temporary: 302 (GET) or 307 (method-preserving). After a POST that should not repeat on refresh: 303. Cache revalidation is 304, not a redirect.
Do redirects hurt SEO or performance?
Single-hop permanent redirects (301/308) pass link equity and are fine. Chains, loops and temporary redirects for permanent moves waste crawl budget, add latency and dilute signals.
Try the JSON Validator
Check JSON syntax and locate errors by line and column.