Export website teams often struggle with balancing content freshness against load times. This article outlines how to configure HTTP Cache-Control headers for static sites, focusing on practical directives like no-cache, immutable, and stale-while-revalidate to improve user experience and server efficiency.

Scenario: Launching a new product landing page

In a hypothetical case, an export website author is preparing a new product landing page before a trade-show announcement. The page will include a hero image, a product spec sheet, a price list, and a short press note. The author knows the launch date but not the final wording of the press note, so the files fall into two rough groups: assets unlikely to change, and documents still being revised.

The first group includes the hero image, the spec sheet, and two font files. The author gives these upload names such as landing-hero-2026.webp, spec-sheet-v3.pdf, and brand-sans-medium.woff2. Each name carries a version marker, which lets the author set a long max-age and mark the response public, so a shared cache may reuse it for many visitors. The spec sheet also gets an ETag value written into the launch checklist, since the author expects to reissue it once translations arrive.

The second group includes the press note and a launch banner that may change hourly during the event. These get shorter max-age values and must-revalidate, so browsers check back before reusing an old copy. The author notes in the checklist that the price list sits between the two: the amounts are fixed by contract, but the currency table may be corrected. The chosen trade-off is to give the price list a moderate max-age and a versioned filename, so a corrected table can be published under a new name instead of waiting for caches to expire.

The author also drafts a compact file-inventory table to keep the decisions visible:

landing-hero-2026.webp | long max-age | public

press-note-draft.txt | short max-age | must-revalidate

price-list-2026-04.pdf | moderate max-age | public

These entries are the author’s own planning notes, not records from a past campaign, and they do not promise how any particular cache will behave. A second revision replaces press-note-draft.txt with press-note-final.txt once the text is approved, keeping the older file in place so existing references still resolve. The point is to show how a launch checklist can pair filenames, header choices, and one clear fallback before the page goes live.

Understanding Freshness vs. Staleness in Caches

An HTTP cache stores a response tied to a request and reuses it for later requests. The page being read states that responses have two states: fresh, usually meaning the stored response is still valid and reusable, and stale, meaning the cached response has expired. The determining criterion is age, the time elapsed since the response was generated—comparable to a TTL in other caching mechanisms.1

With a response carrying max-age=604800, the page explains that an age under one week makes the response fresh, while an age exceeding one week makes it stale; while it remains fresh, it is used to fulfill client requests. Stale responses are not immediately discarded: validation sends a conditional request with If-Modified-Since or If-None-Match, and a 304 Not Modified lets the client revert the stored stale response to fresh. The page notes If-None-Match takes precedence when both validators are present.1

For the landing page you are preparing, start by recording, next to each upload file, how long the content should stay usable before a returning visitor should be asked for a fresh copy. You can do this in a simple two-column note in your own working document. For example, beside the hero image you might write “months, rarely replaced,” while beside the press note you might write “days, still being reworded.” These are your estimates, not guarantees about how any cache will behave, and you can revise them as the launch date approaches.

Once that note exists, you can sort each file by how costly a stale copy would be at the moment a visitor opens the page. A slightly old hero image may be acceptable, while an outdated price list could mislead a buyer. Writing that risk beside each entry helps you decide which files deserve a longer freshness period and which ones you would rather have rechecked more often.

If you revise the press note wording, revisit only its entry and adjust the freshness period rather than reworking the whole note. You might also keep a short “why” line for each decision, such as “image unlikely to change before the announcement.” This keeps your own reasoning visible when you compare options later, and it lets you change your mind without losing the trail of what you chose and why.

Implementing Cache Busting with Immutable Assets

For the “cache-busting” pattern, the MDN Cache-Control reference describes including a version or hash in a static asset's filename or query string, so that updated content gets a different URL. Its example uses a numbered library filename and a hashed image path, then applies a long max-age with immutable to the assets path.2

The same reference adds immutable to tell a cache the response will not change while fresh, avoiding validation requests on reload. It also says to use no-cache for the HTML response so clients revalidate and receive the new version referencing updated asset URLs.2

For the landing page you are preparing, you can make immutable-asset caching easier to apply by deciding, file by file, whether a revised version would ever reuse the same upload name. For the hero image and spec sheet, consider versioned names such as landing-hero-2026-v2.webp and spec-sheet-2026-04.pdf. When you replace one, the new name creates a fresh request path while the old copy stays harmless for returning visitors.

You might then keep a short personal ledger beside your working folder, with columns for file, version marker, and the date you last replaced it. A filled example could read: hero image, v2, 12 March 2026; spec sheet, 2026-04, 10 March 2026. This is your own planning note, not a claim about how any cache will respond.

For the press note, which is still being revised, you can choose a name that includes the revision date, such as press-note-2026-03-12.txt, and change only that marker when the wording changes. The older name is then simply out of date rather than overwritten. You might also note in your ledger which assets you expect to rename and which you expect to leave untouched through launch.

Handling HTML Entry Points with No-Cache

For the HTML entry point, the source describes applying no-cache to the HTML response itself so that it is not cached: “Use a no-cache to make sure that the HTML response itself is not cached.” The source states that no-cache allows caches to store a response but requires it to be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. Revalidation can let the client receive a new version of the HTML response and the static assets it references.2

The source also notes that no-cache does not guarantee revalidation for history navigations such as the Back button: if the back/forward cache is used, the browser restores a snapshot of the page without revalidating, and even without bfcache the browser may serve the cached response without revalidating.2

For the HTML entry point of the landing page you are preparing, you can note a short freshness window and mark it to be revalidated, since that document is the doorway through which visitors reach every other file. A filled note might read: index.html entry, revalidate on each visit, review date before the announcement. This is your own working decision, not a claim about how any particular cache will behave.

You might also record what should happen when the entry page and the assets it references disagree. If the hero image name stays the same but the entry page now points elsewhere, consider adding a version marker to the entry note so the two are easy to compare. A plan such as “entry: revalidate; assets: versioned names” keeps the trade-off visible without requiring you to rewrite the whole inventory.

When the press note wording finally settles, you can revisit only its entry and leave the entry-point line untouched. If the launch date slips, adjust the review date in the same note rather than starting a new list. These records are preparations for your own page, and you remain free to choose whether the entry stays revalidated or receives a slightly longer window once the announcement period ends.

Optimizing User Experience with Stale-While-Revalidate

RFC 5861 defines stale-while-revalidate as a Cache-Control extension that lets a cache return a stale response immediately while it revalidates in the background, hiding network and server latency from clients. The example max-age=600, stale-while-revalidate=30 means the response is fresh for 600 seconds and may be served stale for up to 30 additional seconds while asynchronous validation is attempted. If validation is inconclusive or no request triggers it, after 30 seconds the extension ceases to operate and the next request blocks and is handled normally.3

For the press note and launch banner in your example, you can add a stale-while-revalidate value beside the short freshness period you already noted, choosing a window that reflects how long a slightly outdated wording still seems acceptable during the event. A filled row in your own ledger might read: press-note-draft.txt, short max-age, stale-while-revalidate, review date. Mark it clearly as a planning note rather than a measured result.

You might also compare two candidate values side by side before settling on one. For instance, note a shorter window for the banner that changes hourly and a longer one for the press note whose wording drifts more slowly. The choice stays yours; the point is to write down why each file received its window so a later revision touches only that row.

If the press note wording settles before the event, you can revisit its entry, shorten or remove the revalidation window, and leave the hero image and spec sheet rows unchanged. You could also add a remark beside the entry page noting that it should be revalidated while the note is in flux. These remain your own working decisions, not predictions of how any cache will respond.

Reviewing Basic Storage Rules and Directives

RFC 9111 lists the response directives under Cache-Control in a dedicated section: max-age, must-revalidate, must-understand, no-cache, no-store, no-transform, private, proxy-revalidate, public, and s-maxage. The same field definition also covers request directives, including its own max-age, max-stale, min-fresh, no-cache, no-store, no-transform, and only-if-cached, and notes that extension directives may be registered.4

The specification's storage rule in Section 3 states that a cache must not store a response unless it carries at least one of the following: a public response directive; a private response directive when the cache is not shared; an Expires header field; a max-age response directive; for a shared cache, an s-maxage response directive; a cache extension allowing storage; or a status code defined as heuristically cacheable. It adds that no-store must not be present and that a final status code is required.4

Now take the file-inventory table you have already filled and turn it into a small review habit rather than a one-time decision. Consider reading each row aloud as a short sentence: file, intended freshness, and what a visitor sees if the cached copy is old. You might mark any row where that sentence sounds wrong, because those are the candidates for revision.

You can also add two temporary columns to the table: one for “change expected before launch?” and one for “how bad is a stale copy?” Filling these in for the hero image and spec sheet is likely quick, while the press note and launch banner may need a firmer answer. A filled example might read: press note, change expected yes, stale copy mildly confusing, so a short window with revalidation stays.

When you revisit the table after the wording settles, consider changing only the affected row and leaving the others untouched. You might note the revision date in the same row so a later reading reminds you why that entry differs from its neighbours.

Frequently asked questions

How should I start recording how long each upload file should stay usable for a returning visitor?

For the landing page you are preparing, start by recording, next to each upload file, how long the content should stay usable before a returning visitor should be asked for a fresh copy. You can do this in a simple two-column note in your own working document.

Once I have that note, how can I sort each file by how costly a stale copy would be?

Once that note exists, you can sort each file by how costly a stale copy would be at the moment a visitor opens the page. A slightly old hero image may be acceptable, while an outdated price list could mislead a buyer.

If I revise the press note wording, what should I revisit and adjust in my notes?

If you revise the press note wording, revisit only its entry and adjust the freshness period rather than reworking the whole note. You might also keep a short “why” line for each decision, such as “image unlikely to change before the announcement.”