304 Not Modified

304
Not Modified

Example HTTP Response

HTTP Response
HTTP/1.1 304 Not Modified
ETag: "abc123"
Common Causes
  • Browser cache is still valid
  • Resource hasn't changed since If-Modified-Since
  • ETag matches, no download needed
Technical Details

What does this mean?

Same old, same old! Nothing has changed since you last checked. Use your cached copy!

Technical Definition

Indicates that the resource has not been modified since the version specified in the request headers.

RFC Says

"The 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition evaluated to false."

Plain English:

The resource hasn't changed since your last request, so use your cached version. This is used with conditional requests (If-Modified-Since or If-None-Match headers) to save bandwidth. The response should not contain a message body.

Common Misinterpretation

304 is not an error - it's a successful response indicating the cache is still valid. Always return appropriate cache headers (ETag or Last-Modified) with the 304 so the client can validate the cache again in the future.

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(304).json({
    error: 'Not Modified',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(304, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Not Modified',
    message: 'Your error message here'
  }));
}).listen(3000);
SEO Handling

Indexing

304 responses don't affect indexing directly. The previously cached content remains indexed. This is purely a caching optimization.

Crawler Behavior

Crawlers use 304 to reduce bandwidth and crawl more efficiently. It tells them the cached version is still valid.

Canonical URL Notes

No canonical implications. The URL's indexing status is determined by the original 200 response, not the 304.

Google Notes

Proper use of 304 with ETags/Last-Modified improves crawl efficiency, letting Googlebot crawl more of your site in its budget.

304 Not Modified FAQ

What causes a 304 Not Modified error?

Browser cache is still valid. Resource hasn't changed since If-Modified-Since. ETag matches, no download needed.