Boutique consulting firms often rely on static sites for speed and simplicity. Configuring HTTP Cache-Control headers correctly is essential for maximizing cache performance. This article outlines key directives defined in RFC 9111 and related extensions, helping you balance freshness, validation costs, and user experience.
Understanding the Basics of HTTP Caching
Imagine a hypothetical boutique consultancy, a small strategy studio that has built its public site as a set of hand-edited static pages: a homepage, four service pages, a few case notes, and a contact form explained in plain text. The author maintaining the site is not a dedicated engineer; they keep the files in a folder, edit headings and copy directly, and occasionally add a page. Their working material is a small configuration file sitting beside the site's assets, plus a notes document where they list each page type and decide how it should behave in caches.
The first concrete artifact is a short inventory table titled "Static asset cache rules." Its columns are: path pattern, content type, change frequency, and intended cache lifetime. Two fictional rows show how the author sorts material. Row one reads pattern "/assets/.css and /assets/.js," content type "stylesheet and script," change frequency "only when the site is redesigned," lifetime "long, with a versioned filename so a change produces a new name." Row two reads pattern "/index.html," content type "HTML page," change frequency "every week or so," lifetime "short, so visitors see fresh copy soon after an edit." A third row, for "case-notes/*.html," is marked "occasional updates" and given a short lifetime, on the reasoning that the notes evolve while the visual assets stay fixed.
The second artifact is a header checklist written as comment lines at the top of the configuration file. The author drafts three entries: "public" for the shared stylesheet and scripts, because they are identical for every visitor; "max-age" with a modest number of seconds for HTML pages, chosen to balance freshness against repeated downloads; and "must-revalidate" beside pages that carry dated information, so a stale copy is checked rather than silently reused. A separate line notes that the long-lived assets also carry an immutable-style marker, dropped only when a filename changes.
The third artifact is the author's own example of a trade-off. For images in a shared folder, they initially wanted a very long lifetime; then they noted that a logo swap would otherwise leave returning visitors on the old file. Their chosen resolution is to keep the long lifetime but rename files with a short suffix when the image changes, and to leave the HTML page lifetime short so the new filename is picked up quickly. They write this reasoning as a one-line comment: "renamed file acts as the signal; page reload brings it in."
These records are worked examples the author composed to make the decisions visible, not evidence of a deployed setup or measured results. Each link destination stays fixed: the stylesheet and script references point to the same assets folder, the case notes point to their own pages, and the contact form instructions point to a page describing the fields. The author's plan is to attach the inventory and checklist to the file, then review the table whenever a page's update rhythm changes.
Defining Freshness with max-age and Expires
RFC 9111 defines a stored response as fresh when it can be reused without validation against the origin server. Freshness can be set explicitly through a max-age response directive, which uses the delta-seconds syntax of one or more digits representing a non-negative integer of seconds, or through an Expires header field.1
The specification treats these as alternatives that permit storage: a response can contain at least one of a public directive, a private directive where the cache is not shared, an Expires field, a max-age directive, an s-maxage directive for shared caches, or another cache extension that allows it to be cached.1
You can sharpen the freshness decision by comparing two candidate lifetimes against your own asset list. Take one entry you have already recorded, such as a stylesheet pattern marked as low change frequency, and write two short alternatives beside it: a shorter max-age for pages that change with each campaign, and a longer max-age for fonts or logos that rarely move. Then note, in ordinary words, what would make you pick one over the other, for example how often the file name itself changes when the content does.
The Expires header can be treated as a second expression of the same choice. For a sample archived announcement page, you might write an Expires date that matches the date you intend to freeze that page, while a current homepage entry could carry a nearer date tied to the next scheduled review. Record both dates next to the same row so the pairing stays visible.
You might also keep a small comparison note for each asset: the chosen value, the rejected value, and one sentence of reasoning. That note is a working artifact you prepare for yourself, not a measured result, and it lets a later reader see why freshness was set where it was.
Optimizing Performance with the immutable Directive
RFC 8246 defines the immutable Cache-Control extension for responses that will not be updated during their freshness lifetime. When the extension is present, clients should not issue a conditional request such as a reload during that lifetime unless the user explicitly overrides it with a force reload. The extension applies only while the stored response is fresh; stale responses should be revalidated as they normally would be without it.2
Clients should ignore immutable for resources outside an authenticated context such as HTTPS, and on force-reload requests that carry no-cache attributes. The specification's example combines it with a long lifetime: max-age=31536000, immutable.2
For one asset already on your list, such as a versioned stylesheet in a shared folder, you can decide whether the immutable directive belongs in its Cache-Control value and record that choice beside the entry. Consider writing two candidate values: one with a long freshness lifetime alone, and one that adds immutable to that lifetime. Next to each, add a short note on why you might pick it, for instance that the file name changes whenever the stylesheet changes, or that you are unsure the whole team renames files consistently.
You might then test the choice against a second entry that does not share those properties, such as a page whose path stays the same while its text is edited. If immutable still looks tempting there, that is a signal to write a note explaining why the rename habit does not apply, rather than copying the value across the table. Your comparison note can hold the chosen value, the rejected value, and one sentence of reasoning, so a later reader sees the decision rather than guessing at it.
If you plan to keep both a current and an archived version of an announcement entry, the same fields can carry different values: the current entry might list a short lifetime with no immutable, while the archived one lists a long lifetime with immutable, each with its own one-line reason. Both remain choices you can revise as your asset list grows.
Handling Stale Content with stale-while-revalidate
RFC 5861 defines stale-while-revalidate as a Cache-Control extension that lets caches serve a stale response while revalidating it in the background, without blocking. The directive carries a delta-seconds value, and 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 more seconds while asynchronous validation is attempted.3
The RFC notes that if the window passes without revalidation, the response should not continue to be served stale; a small window or sparse traffic means some requests fall outside it and block until the cache validates.3
The document also describes stale-if-error, an independent extension with its own delta-seconds value, and recommends predating background validation on an incoming request to reduce amplification risk.3
You can take one entry from your asset inventory—say, the current announcement page you already marked as changing weekly—and draft a second version of its Cache-Control line that adds stale-while-revalidate with a short window, such as one hour. Then consider writing the same field for the archived announcement: perhaps a much longer stale window, since old text rarely changes. Your choice of window lengths is yours; the point is to record both versions side by side.
For a worked comparison, you might list three columns in your notes: entry, current-entry value, archived-entry value. A filled example could read “Spring workshop announcement,” “max-age=600, stale-while-revalidate=3600,” and “max-age=86400, stale-while-revalidate=604800.” Add one sentence per row explaining the reasoning, and note which reader-facing page the entry points to. These are hypothetical drafts, not tested results.
Before committing, you can re-read the pair and ask whether revalidation in the background matches how often you actually revise that page. If the answer is uncertain, keep the shorter window and record the doubt in your notes rather than resolving it now.
Managing Errors with stale-if-error
Under RFC 5861, stale-if-error is a Cache-Control extension indicating that when an error is encountered, a cached stale response may satisfy the request regardless of other freshness information. The RFC defines an error as any situation that would return a 500, 502, 503 or 504 status code. Its value sets the upper limit to staleness; once the cached response is more stale than that amount, the cached response should not be used, absent other information.3
The same directive can appear as a request or response extension, and its scope depends on where it appears. It does not affect freshness, and stale responses used this way should still be visibly stale, with a non-zero Age header and a warning header.3
In the RFC's example, a response carries max-age=600 with stale-if-error=1200, so it is fresh for 600 seconds and usable for an additional 1200 seconds of staleness if an error occurs. A validation attempt at 900 seconds that encounters a 500 error can return the successful response with Age: 900; after the age exceeds 1800 seconds, the cache must write the error message through.3
Take the current and archived announcement entries you have already paired in your notes, and add one more comparison column called stale-if-error. In that column, you can write down what the reader should see if revalidation fails: whether an older copy is acceptable for a short window, and how long that window should be. The values belong to your own editorial judgment, not to an external requirement.
For a filled example, the current entry might read “serve stale for one hour on error; the page changes weekly, so a brief delay is tolerable.” The archived entry might read “serve stale without a short limit; the text is frozen, so an old copy matches what a reader would get anyway.” You can then re-read both rows and ask whether the shorter window fits how often you actually revise the current page.
If the answer is unclear, you might draft a second candidate value for just the current entry and leave the archived one unchanged. Keeping the two side by side lets you compare the trade-off in your own words before you settle on either.
Best Practices for Static Site Configuration
Take the current and archived announcement entries you have already paired in your notes, and add one more comparison column called stale-if-error. In that column, you can write down what you would want a reader to see if your origin briefly fails: the last cached copy, or nothing at all. For a filled example, the current entry might read “serve stale for one hour on error; the page changes weekly, so a brief delay is tolerable.” The archived entry might read “serve stale for one day; this version is frozen, so an old copy is still accurate.” Neither value is a verified setting—they are your own decisions written beside your own material.
If the answer is unclear, you might draft a second candidate value for just the current entry and leave the archived one unchanged. Keeping the two side by side lets you see whether the difference is really about how often each page changes or simply about how cautious you feel. You can choose the calmer option and note one sentence of reasoning underneath, so a later revision has something to argue with.
You might also keep a short “why” line under each pair, written in plain words rather than header syntax. For the announcement pair, one line could read “current: short freshness because edits are likely; archived: long freshness because edits are not.” That line is for you, not for the configuration file, and it can be as informal as you like.
When you have filled the stale-if-error column for your pair, re-read the two rows together and ask whether the contrast still makes sense. If it does not, you can merge them back into a single entry and record that decision instead. Either way, the artifact stays small and stays yours, ready to revisit when your publishing habits change.
Frequently asked questions
What columns would I include in a short inventory table of my own static asset cache rules?
The first concrete artifact is a short inventory table titled "Static asset cache rules." Its columns are: path pattern, content type, change frequency, and intended cache lifetime.
What small comparison note might I keep for each of my assets?
You might also keep a small comparison note for each asset: the chosen value, the rejected value, and one sentence of reasoning.
How might I write a short plain-words “why” line under each pair in my notes?
You might also keep a short “why” line under each pair, written in plain words rather than header syntax. For the announcement pair, one line could read “current: short freshness because edits are likely; archived: long freshness because edits are not.”
RFC 9111: HTTP Caching . Retrieved 2026-11-21. ↩︎ ↩︎
RFC 8246 - HTTP Immutable Responses . Retrieved 2026-11-21. ↩︎ ↩︎
RFC 5861 - HTTP Cache-Control Extensions for Stale Content . Retrieved 2026-11-21. ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎