304 Not Modified

HTTP Status CodesRedirection (3xx)commonStatus Code: 304Last updated: todayTested on:Google ChromeNode.js v20 LTSJune 2026

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

304 Not Modified Quick Fix⏱️ Est. Fix Time: 3 minutes

Usually happens because:

  • Client requests carrying cached ETag
  • Client requests with If-Modified-Since values

🔍 Quick Checklist:

Meaning

The HTTP 304 Not Modified redirection status code indicates that there is no need to re-transmit the requested resources. It is an implicit redirection to a cached local copy. This code is returned when conditional headers (e.g., If-None-Match, If-Modified-Since) verify no changes.

Root Causes

  • Client requests carrying cached ETag hashes matching server resource state ETag.
  • Client requests with If-Modified-Since values newer than server last-modified timestamps.
CauseFrequency
Client requests carrying cached ETag⭐⭐⭐⭐⭐
Client requests with If-Modified-Since values⭐⭐⭐⭐

Common Mistakes

  • Sending a response body payload on a 304 response, causing connection errors.
  • Miscalculating ETag values, resulting in clients getting stale cached assets.

How to Fix

1Configure web servers to generate and compare ETag hashes correctly.
2Return the 304 code without any response body payload.

Framework-Specific Examples

Express conditional caching using ETag middleware.

Express Example
app.get('/data', (req, res) => {
  const data = { id: 1 };
  res.setHeader('ETag', 'hash-123');
  if (req.headers['if-none-match'] === 'hash-123') {
    return res.status(304).end();
  }
  res.json(data);
});

Server Configuration Examples

Nginx conditional header caching settings.

Nginx Config
etag on;
expires 1h;

Prevention

  • Use server-level ETag filters (like Nginx etag on) to automate caching validations.
  • Verify cache headers (Cache-Control, Last-Modified) are configured consistently.

Frequently Asked Questions (FAQ)

Q: Does a 304 response contain a body?

No. A 304 response must not contain a message body. Any headers that would describe the body (like Content-Length) should refer to the cached representation.

Q: What triggers a 304 response?

A 304 is triggered when the client sends conditional validation headers (If-None-Match or If-Modified-Since) and the server verifies that the resource state hasn't changed.

Q: How does 304 Not Modified help server performance?

It eliminates the need to download large files again, dramatically reducing network bandwidth consumption and speeding up page rendering.

Q: What is an ETag?

An Entity Tag (ETag) is a unique string hash generated by the server representing a specific version of a resource file.

Still having this problem?

Didn't solve your problem?

SuggestRequest Error