A static site removes PHP from the request path. It does not remove caches. Between your publish and the visitor there are at least three: the browser, the host’s CDN and any proxy you put in front. A publish that changes files but not caches is a publish nobody sees.
The good news is that the rules are old and well understood. The bad news is that one wildcard in a headers file can pin your HTML for a year.
What the headers mean
max-age. Seconds a browser may use the response without asking again.s-maxage. The same for a shared cache such as a CDN. It overridesmax-agethere.must-revalidate. Once stale, the cache must check with the origin rather than serve a stale copy.no-cache. Store it, but check every time. It does not mean “do not cache”, which is the most common misunderstanding in this file.no-store. Do not write it to disk or memory at all. Rarely what you want for a page.immutable. The browser will not revalidate even on reload. Only safe when the URL changes with the content.ETagandLast-Modified. Validators. A conditional request can come back304 Not Modifiedwith no body.
What StaticScope writes
StaticScope itself has no opinion about cache headers. The S3 add-on does: HTML and HTM go up as public, max-age=0, must-revalidate, everything else as public, max-age=3600. Both are changeable with staticscope_s3_cache_control, which receives the file path.
A changed header only applies to files uploaded after the change. Objects already in the bucket keep what they were sent with, so clear the bucket or touch the files before you expect the new policy to apply.
Here is the part that matters more than any header: StaticScope does not fingerprint asset filenames. An image stays at /wp-content/uploads/2026/05/photo.jpg when you replace it. A theme stylesheet keeps its path and may carry WordPress’s ?ver=, which changes when the theme version changes and not when you edit the file. There is no content hash in the URL to make a long cache safe.
That is why the defaults are conservative. A page is always checked and an asset is trusted for an hour. If you want a year and immutable, you need to add the fingerprint yourself. A purge clears the edge, not a browser that already has the file.
The HTML cache problem
The classic mistake is a headers file that starts with /* and gives everything a year. It looks efficient. It also means the HTML is cached for a year, so the next publish changes the origin and reaches nobody who has visited before.
Netlify and Cloudflare Pages read _headers from the published site. The safe default is one rule that keeps HTML fresh.
# _headers
/*
Cache-Control: public, max-age=0, must-revalidate
That covers assets too, so nothing is cached long. A separate hour for /wp-content/uploads/* is where the hosts diverge. Cloudflare Pages applies every matching rule and joins duplicate Cache-Control values, so a broad rule plus an asset rule gives the response two max-age directives; its documentation uses ! Cache-Control on the narrower rule to replace the broad one. Netlify’s matching is different again. Check the host’s documentation and verify with curl rather than assuming the specific rule wins.
The GitHub add-on keeps _headers across publishes, so the file survives. On Cloudflare Pages, check that the behaviour you get is the one you configured: a Cache Rule on text/html can override the header and reintroduce the trap.
On nginx the split is explicit, and there is no wildcard to get wrong:
location ~* \.html?$ {
add_header Cache-Control "public, max-age=0, must-revalidate";
}
location /wp-content/uploads/ {
add_header Cache-Control "public, max-age=3600";
}
ETag and revalidation
With max-age=0, must-revalidate the browser stores the page and asks the server whether it changed. If the ETag still matches, the answer is a 304 and no body. That saves bandwidth, not a round trip. The visitor still waits for the check.
That round trip is the price of an immediate publish, and it is a good trade for HTML. For assets, an hour of max-age removes most of those checks without making a stylesheet stale for long. If you need both, use s-maxage for the edge and let browsers revalidate: the CDN absorbs the traffic and a publish is at most that many seconds stale.
ETags are generated by the host or the CDN. S3 uses an MD5 for a simple upload and something else for a multipart one. Do not build logic on the value. Treat it as opaque and let the conditional request do its job.
Deploy previews
Netlify and Cloudflare Pages give preview deployments their own hostnames. Those hostnames have their own caches and often their own header behaviour. A preview can look current while production serves yesterday’s page, because you are not comparing the same cache.
Previews are still useful. They catch a broken layout and a wrong branch before the live domain does. Run the final cache check on the production hostname. The noindex tag StaticScope adds to non-live environments also tells you which one you are looking at.
Making a publish visible now
- Confirm the deploy finished and the commit or upload is the one you expected. A successful deploy of the wrong branch is still a successful deploy.
- Check the response headers on the live domain.
agegreater than zero means a shared cache is serving it. - Purge the CDN or proxy in front of the host. A host deploy purges its own edge, not the Cloudflare zone or corporate proxy you added.
- Keep HTML at
max-age=0. If you need an edge TTL, make it short and know that it delays every publish. - Hard-reload in a private window. A service worker can serve old HTML even after the network cache is clear.
- Check the asset URLs in the new HTML. If a stylesheet kept its name, a browser may still hold the old one for an hour.
curl -sI https://example.com/ | grep -iE 'cache-control|age|etag|cf-cache-status|x-cache'
cf-cache-status: HIT, x-cache: Hit or a large age all say the same thing: you are looking at a cache, not the origin. The fix is a purge or a shorter TTL, not another publish.
When you cannot set headers
GitHub Pages does not let you set response headers. Its CDN cache is short, but it is not zero and you cannot purge it. A publish can take a few minutes to appear, and there is no supported lever. The workarounds are to put Cloudflare in front and control the cache there, or to accept the delay.
S3 without a CDN gives you object headers and nothing else. That is enough for HTML if the objects say max-age=0. With CloudFront in front, the distribution’s cache policy has the final say. A policy with a long minimum TTL will hold HTML regardless of what S3 sent, which is exactly the trap in a different place.
A cache policy that works
HTML: public, max-age=0, must-revalidate. Assets: public, max-age=3600 unless the URL changes with the content, in which case a year and immutable is reasonable. Fonts and theme CSS are not fingerprinted, so leave them at an hour. If you add a CDN with a purge API, purge after every publish and you can be more generous at the edge.
That policy has one visible cost: every page view makes a conditional request. On a static host that request is cheap and the 304 is small. It is a better trade than a site that is fast to load and slow to update.