304 not modified

Main Hero

Definition

304 Not Modified is an HTTP status code that tells a web browser or client that the requested resource has not changed since the last time it was accessed. Instead of downloading the resource again, the browser uses the cached version already stored locally. This reduces bandwidth usage and improves page load speed for returning visitors.

The 304 status code is part of web caching mechanisms, ensuring efficiency between browsers and servers. It helps optimize performance while maintaining consistency of website content delivery.

Advanced

Technically, 304 Not Modified is triggered when a client sends conditional requests using headers such as If-Modified-Since or If-None-Match. If the server determines the resource has not been updated, it responds with the 304 code and no message body. The client then loads the cached version.

This mechanism is widely used in content delivery networks (CDNs), proxies, and caching layers to minimize unnecessary data transfers. Proper cache configuration requires setting headers such as ETag, Cache-Control, and Last-Modified to manage validation accurately. Advanced implementations integrate with performance optimization strategies for large-scale websites.

Why it matters

  • Improves website performance by reducing page load times.
  • Saves bandwidth and server resources by avoiding redundant downloads.
  • Enhances user experience with faster repeat visits.
  • Supports efficient caching strategies in CDNs and browsers.
  • Helps scale web applications with reduced infrastructure strain.

Use cases

  • A news site allowing returning visitors to load cached images and scripts instead of re-downloading.
  • An e-commerce store improving performance during high-traffic events by reducing redundant requests.
  • A CDN delivering cached content globally while validating freshness.
  • A corporate intranet caching large documents for frequent access.

Metrics

  • Cache hit ratio across browsers or CDNs.
  • Reduction in bandwidth consumption.
  • Average page load speed improvements.
  • Number of 304 responses logged versus full downloads.
  • Server response time for conditional requests.

Issues

  • Incorrect cache configuration may cause outdated content to display.
  • Overuse of caching may delay updates reaching end users.
  • Lack of proper ETag or Last-Modified headers reduces effectiveness.
  • Misconfigured caches can create inconsistencies across regions or devices.

Example

An online retailer optimized its site by enabling 304 responses for static resources like images and scripts. Returning customers experienced faster load times, while the company reduced bandwidth costs during seasonal sales traffic surges.