[Web] HTTP status code 304 Not Modified

HTTP 304 “Not Modified” Status

When a web browser requests a page (or any resource like images, CSS, or JavaScript) it often sends headers to check whether the version in its cache is still valid. If the server sees that nothing has changed since the last time the client fetched it, the server responds with HTTP 304 Not Modified. This tells the client:

“You can use the cached version you already have.”

 How It Works

  1. Client Request
    The browser typically includes an If-Modified-Since or If-None-Match header indicating the date or an ETag of the last known version.

  2. Server Check

    • The server compares the request header value with its current resource.

    • If unchanged, it returns a 304 Not Modified status, without the full resource body.

  3. Client Uses Cache

    • On receiving a 304, the browser reuses its cached copy.

    • No download of the resource is needed, saving bandwidth and speeding up response time.

Why It’s Helpful

  • Performance: Minimizes data transfer, reduces load times.

  • Bandwidth Savings: No need to resend a file that hasn’t changed.

  • Better User Experience: Faster page loading when assets are already cached.

Comments