304

Not Modified

3xx Redirection

Back to list

Server perspective

Use 304 for conditional GET or HEAD requests when the client's cached representation is still current.

When to use

  • Return 304 when If-None-Match or If-Modified-Since validates successfully
  • Use it to save bandwidth for unchanged cacheable resources

How to respond

  • Do not include a response body
  • Include the cache-related metadata headers the client needs to update its stored response

Headers to consider

  • Date
  • ETag
  • Last-Modified
  • Cache-Control
  • Expires
  • Vary
  • Content-Location

Response body

  • Do not include a response body in a 304 response.

Server-side pitfalls

  • Do not return 304 for unconditional requests
  • Return 200 with the representation when the resource changed

Examples

ETag cache validation

Request:GET /assets/app.js with If-None-Match: "abc123"
Response:304 Not Modified with no body

The server confirms the cached asset is still valid.

References

Related 3xx Redirection Codes