One Changed Character, 162 Changed Files
On 17 November I changed one argument in this site's JavaScript. The consent code called window.__tcfapi("addEventListener", 2.2, ...), and I changed 2.2 to 2. The commit that shipped it touched 162 files.
That is what content-hashed filenames cost on a site with no build tool. Before the change the bundle was called main.7ea636b2.js, and after it, main.f66efe8e.js, because the name carries a hash of the file's content. Every page that loads the bundle has to point at the new name, and on codertronix.com that is 51 HTML files. Each of them has a .br and a .gz copy next to it, so 153 of the 162 changed files were pages and their compressed copies.
This post builds a small script that does the rename, and tests it on a copy of the site. Along the way it covers how the hash is made, what nginx sends for hashed and unhashed files, why the hash goes in the filename, and the main risk of the scheme: an old page asking for a bundle that no longer exists.
How the Site Names Its Assets
The site is plain HTML, CSS and JavaScript, served as static files by nginx. There is no bundler, no npm build and no asset pipeline. When I wrote this, three files carried a hash in their name: css/style.f625664f.css, js/main.f66efe8e.js and js/motion.e601437c.js. Publishing this post renamed the JavaScript bundle again, because the search index lives in it. The bundle names in the commands below are the ones that were live on 17 November, so check the page source for the current name before you run them.
The hash is the first 8 hex characters of the SHA-256 of the file's bytes. Nothing else goes into it: no date, no version number, no path. You can check that the names are honest with sha256sum, run from the repo root:
for f in css/style.*.css js/main.*.js js/motion.*.js; do
printf '%-26s %s\n' "$f" "$(sha256sum "$f" | cut -c1-8)"
done
Each name matches its content, and the whole scheme depends on that. If I open main.f66efe8e.js and change one byte, the name is now wrong about what is inside, and the hash of the new bytes is the name the file should have.
Eight hex characters is 32 bits. That is far too short for anything security-related, but it only has to tell apart versions of the same file. After 100 versions of main.js, the chance that any two share a prefix is roughly one in a million. If that still worries you, use 10 or 12 characters. The nginx pattern below accepts anything from 6 to 32.
One script is left unhashed on purpose: js/comments.js, the comments widget on post pages. The section on when hashing is overkill explains why.
What nginx Sends for Each Kind of File
The hash only matters because of the caching headers. The rules live in nginx/snippets/static-cache.conf, and the first two blocks are the ones that matter here:
# Hashed CSS/JS: content-hash in filename, safe to cache forever
location ~ "^/(?:css|js)/.+\.[0-9a-f]{8}\.(?:css|js)$" {
include /etc/nginx/snippets/security-headers.conf;
add_header Cache-Control "public, immutable, max-age=31536000" always;
access_log off;
try_files $uri =404;
}
# Generic CSS / JS (no hash): short cache with revalidation
location ~* \.(?:css|js|mjs)$ {
include /etc/nginx/snippets/security-headers.conf;
add_header Cache-Control "public, max-age=86400, stale-while-revalidate=604800" always;
try_files $uri =404;
}The first block matches only CSS and JS paths that end in a dot, exactly 8 lowercase hex characters and the extension. Those get a year (31,536,000 seconds) plus immutable. Every other CSS or JS file falls through to the second block. It is fresh for one day, and for a week after that the browser may use its copy once while it checks for a new one in the background.
The order of the two blocks matters. nginx checks regex locations in the order they appear in the config file and stops at the first match. main.f66efe8e.js matches both patterns and gets the long header only because its block comes first. Swap them and every hashed file drops to a one-day cache.
HTML has its own block in the server config:
location ~* \.html$ {
include /etc/nginx/snippets/security-headers.conf;
add_header Cache-Control "public, max-age=300, must-revalidate" always;
}That is five minutes, after which the browser must check with the server before reusing its copy. Here is what each kind of file gets from the live site:
for u in /js/main.f66efe8e.js /js/comments.js /posts/nginx-configuration.html /; do
echo "== $u"
curl -sI -H 'Accept-Encoding: br' "https://codertronix.com$u" \
| grep -iE '^(HTTP|cache-control|content-encoding|etag)' | tr -d '\r'
done
The bundle is immutable for a year and comments.js gets the one-day rule. A post page gets five minutes with must-revalidate. The homepage is a little different. / is served by an exact-match location in never-block.conf with max-age=300, stale-while-revalidate=3600, so for an hour after its five minutes run out, a browser may show its stored copy once while it fetches a fresh one.

The year only holds up because of immutable. MDN says the directive means "the response will not be updated while it's fresh." The browser can then skip the conditional request it would otherwise send when the user reloads. web.dev's HTTP cache guide recommends a one-year max-age for fingerprinted files and lists immutable as a further optimization. HTML gets the opposite treatment because its URL cannot change. Nobody types index.7ea636b2.html, so the page has to be checked often, and the page is what tells the browser which bundle name to fetch.
A regex gotcha: hex is also English
The first version of this rule was looser: ~* with [0-9a-f]{6,32}. That is less strict than it looks. Plenty of English words use only the letters a to f, and ~* is case-insensitive. I ran that pattern over a few names:
printf '%s\n' /js/main.f66efe8e.js /js/ui.facade.js /css/print.decade.css /js/comments.js /css/Style.BEEF01.css \
| grep -iE '^/(css|js)/.+\.[0-9a-f]{6,32}\.(css|js)$'
Under that rule ui.facade.js and print.decade.css would have been cached as immutable for a year with no hash at all, and Style.BEEF01.css matched because of ~*. Nothing on this site had a name like that, but I changed the rule to the one shown above: exactly 8 hex characters, case-sensitive with ~. Run over the same five names, it matches only main.f66efe8e.js.
Why the Hash Goes in the Filename, Not in ?v=
The other common way to bust a cache is a query string: keep main.js and link to main.js?v=7. MDN lists both and says that adding a version or hash "to the filename or query string is a good way to manage caching." The browser treats a different URL as a different cache entry, so the query string does its job there. On this server it would fall short, for three reasons.
First, nginx picks a location from the path alone. Its docs say matching is done "against a normalized URI", and the query string is not part of that. A ?v= on comments.js cannot move it into the immutable block. Second, the server ignores the query when it picks the file, so every version string gets today's bytes:
for q in "" "?v=1" "?v=anything"; do
printf '%-34s ' "/js/main.f66efe8e.js$q"
curl -s -o /dev/null -D - "https://codertronix.com/js/main.f66efe8e.js$q" \
| tr -d '\r' | grep -i '^etag' | tr '\n' ' '; echo
done
for q in "" "?v=2"; do
printf '%-34s ' "/js/comments.js$q"
curl -s -o /dev/null -D - "https://codertronix.com/js/comments.js$q" \
| tr -d '\r' | grep -i '^cache-control'
done
All three requests for the bundle came back with the same ETag, and comments.js?v=2 got the same one-day header as plain comments.js. So ?v=1 does not fetch the old version. It is just another name for the current file. With the hash in the filename, the old and new bundles are separate files that can sit on disk side by side during a deploy. That is the fix for the 404 problem later in this post.
Third, the name checks itself. Because the hash comes from the content, a script can tell whether someone edited a hashed file in place, with no manifest and no record of the last version. The script below relies on that. A ?v=7 says nothing about the bytes.
Google gives one more reason in its JavaScript SEO guide. It says Googlebot "caches aggressively" and that its renderer "may ignore caching headers", so it recommends putting a content fingerprint in the filename. Its example is main.2bb85551.js, the same shape this site uses.
What One Rename Touches
Before writing a script, I counted what a rename has to change:
grep -rl --include="*.html" "main.f66efe8e.js" . | wc -l
grep -rho --include="*.html" 'src="[./]*js/main.f66efe8e.js"' . | sort | uniq -c
That is 51 pages, with three different ways of writing the path. Posts and pages use ../js/main.f66efe8e.js. index.html at the root uses js/main.f66efe8e.js. 404.html uses /js/main.f66efe8e.js, because nginx serves it for missing URLs at any depth and a relative path would break on /posts/missing.html. A replace that looked for one exact src string would miss two files. Replacing only the filename catches all three.
Git history shows how often this happens:
git log --diff-filter=R -M --format='%ad' --date=short --name-status -- 'js/main.*.js' \
| awk 'NF==1{d=$1} $1 ~ /^R/{print d, $2, "->", $3}'
Git's rename detection finds nine renames of main.js, the first on 27 October and seven of them that same day. The 28 October rename came from adding a post. The site search index lives inside main.js, so adding the EC2 deploy post added seven lines to the bundle and changed its hash from db232882 to 7ea636b2. That commit touched 177 files, including the new post's images. The 17 November rename was the one-character consent change from the opening. In both commits, the change to most pages was a single line, the script tag.

The Rename Script
The manual steps are always the same, in the same order. Work out the new name from the content. Write the new file. Point every page at it. Recompress what changed. Remove the old file. Here is a script that does exactly that. It is a teaching version I wrote for this post and tested against a copy of the site's files, never the live repo.

#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["brotli==1.1.0"]
# ///
"""Rename hashed CSS/JS files whose content no longer matches the hash in their name.
Edit js/main.<hash>.js in place, then run this. For every css/ or js/ file named
<name>.<8 hex>.<ext> whose SHA-256 no longer starts with those 8 hex characters, it:
1. writes the file under its new name
2. rewrites every .html file that mentions the old name
3. deletes the old file and its .br/.gz siblings (unless --keep-old)
4. writes fresh .br/.gz siblings for the new file and every rewritten page
Usage:
uv run rehash.py SITE_ROOT --dry-run
uv run rehash.py SITE_ROOT [--keep-old]
"""
from __future__ import annotations
import argparse
import gzip
import hashlib
import io
import os
import re
import sys
from pathlib import Path
import brotli
HASHED = re.compile(r"^(?P<stem>.+)\.(?P<hash>[0-9a-f]{8})\.(?P<ext>css|js)$")
def short_hash(data: bytes) -> str:
return hashlib.sha256(data).hexdigest()[:8]
def gzip_bytes(data: bytes) -> bytes:
buf = io.BytesIO()
with gzip.GzipFile(fileobj=buf, mode="wb", compresslevel=9, mtime=0) as f:
f.write(data)
return buf.getvalue()
def write_siblings(path: Path, data: bytes) -> None:
st = path.stat()
for ext, packed in ((".gz", gzip_bytes(data)), (".br", brotli.compress(data, quality=11))):
sib = path.with_name(path.name + ext)
sib.write_bytes(packed)
os.utime(sib, ns=(st.st_atime_ns, st.st_mtime_ns)) # nginx docs: keep mtimes equal
def stale_assets(root: Path) -> tuple[list[tuple[Path, Path]], list[Path]]:
"""Return (renames, leftovers).
renames: (old_path, new_path) for every hashed asset whose name no longer matches its content
leftovers: files a previous --keep-old run left behind (same bytes as a correctly named file)
"""
renames, leftovers = [], []
for d in ("css", "js"):
for p in sorted((root / d).glob("*.*.*")):
m = HASHED.match(p.name)
if not m:
continue # comments.js and friends: unhashed on purpose
data = p.read_bytes()
h = short_hash(data)
if h == m["hash"]:
continue
new = p.with_name(f"{m['stem']}.{h}.{m['ext']}")
if new.exists() and new.read_bytes() == data:
leftovers.append(p)
else:
renames.append((p, new))
return renames, leftovers
def delete_with_siblings(p: Path) -> None:
for f in (p, p.with_name(p.name + ".br"), p.with_name(p.name + ".gz")):
f.unlink(missing_ok=True)
def main() -> int:
ap = argparse.ArgumentParser()
ap.add_argument("root", type=Path)
ap.add_argument("--dry-run", action="store_true", help="print the plan, change nothing")
ap.add_argument("--keep-old", action="store_true", help="leave the old file in place for one more deploy")
args = ap.parse_args()
root = args.root.resolve()
plan, leftovers = stale_assets(root)
pages = sorted(root.rglob("*.html"))
for p in leftovers:
if any(p.name.encode() in h.read_bytes() for h in pages):
print(f"leftover {p.name} is still referenced; leaving it")
elif args.dry_run or args.keep_old:
print(f"leftover {p.name} from the last deploy (would delete)")
else:
delete_with_siblings(p)
print(f"deleted leftover {p.name} (+ .br/.gz)")
if not plan:
print("all hashed assets match their content")
return 0
for old, new in plan:
data = old.read_bytes()
old_ref, new_ref = old.name.encode(), new.name.encode()
hits = [p for p in pages if old_ref in p.read_bytes()]
print(f"{old.relative_to(root).as_posix()} -> {new.name} ({len(hits)} pages)")
if args.dry_run:
for p in hits[:3]:
print(f" would rewrite {p.relative_to(root).as_posix()}")
if len(hits) > 3:
print(f" ... and {len(hits) - 3} more")
continue
new.write_bytes(data)
write_siblings(new, data)
for p in hits:
# bytes in, bytes out: CRLF line endings survive untouched
html = p.read_bytes().replace(old_ref, new_ref)
p.write_bytes(html)
write_siblings(p, html)
if args.keep_old:
print(f" kept {old.name} for one more deploy")
else:
delete_with_siblings(old)
print(f" deleted {old.name} (+ .br/.gz)")
print(f" rewrote {len(hits)} pages, wrote {2 + 2 * len(hits)} compressed siblings")
leftover = [p for p in pages for old, _ in plan if old.name.encode() in p.read_bytes()]
if leftover and not args.dry_run:
print(f"ERROR: {len(leftover)} pages still reference an old name", file=sys.stderr)
return 1
return 0
if __name__ == "__main__":
sys.exit(main())A few choices in it are deliberate:
- It finds stale files by recomputing hashes. You never tell it which file you edited. Any file in
css/orjs/namedname.8hex.extwhose content no longer hashes to its name is stale.comments.jshas no hash in its name, so it is skipped. - It works on bytes. HTML files here use CRLF line endings. Reading and writing bytes keeps them exactly as they were, so the only change in each page is the filename.
- It writes the new file before it deletes the old one, and the last loop checks that no page still names an old file and exits with status 1 if one does.
- It writes the
.brand.gzcopies itself, using the same settings as the repo'scompress.py(gzip level 9 withmtime=0, Brotli quality 11), and copies the source file's modification time onto both. nginx'sgzip_staticdocs recommend that "the modification date and time of original and compressed files be the same." --keep-oldleaves the old file name in place. Its bytes are the new code, because the file was edited before it was copied to its new name, so an old page that asks for the old name still gets a working script. On the next run, the script finds a file whose bytes match a correctly named file. It checks that no page still references it, then deletes it.
Its scope is small. It does not minify, it does not follow url() references inside CSS, and it only looks for references in .html files. If your JavaScript loads another hashed file by name, you need to handle that as well. I checked, and main.js here never names motion.js or style.css.
Dry Run and Real Run on a Copy
The repo has a hook that commits every change automatically, so I tested the script on a copy. I copied css/, js/, pages/, posts/ and the root HTML files into a scratch folder called site and ran everything there.
For a realistic edit, I undid the 17 November change in the copy, turning 2 back into 2.2. If the hash really depends only on the bytes, the file should now hash to the name it had in October:
sed -i 's|"addEventListener", 2, function|"addEventListener", 2.2, function|' site/js/main.f66efe8e.js
sha256sum site/js/main.f66efe8e.js | cut -c1-8
uv run -q rehash.py site --dry-run
It does. The hash is 7ea636b2, the exact name git shows before 17 November. The dry run finds the one stale file and the 51 pages that name it, and changes nothing. Next came the real run, followed by a few checks:
uv run -q rehash.py site
ls site/js
grep -rl --include="*.html" main.7ea636b2.js site | wc -l
uv run -q rehash.py site
uv run -q verify_siblings.py site
The old file and its two compressed copies are gone, and all 51 pages now carry the new name. A second run finds nothing to do, and every .br and .gz next to an HTML, CSS or JS file in the copy decompresses to the exact bytes of its source. The 104 compressed files are two for the bundle plus two for each of the 51 pages. file still reported CRLF line endings on the rewritten pages. The check script is short:
# /// script
# dependencies = ["brotli==1.1.0"]
# ///
"""Check that every .html/.css/.js file under ROOT has .br/.gz siblings that decode to it."""
import gzip
import sys
from pathlib import Path
import brotli
root = Path(sys.argv[1])
files = list(root.rglob("*.html")) + list(root.glob("js/*.js")) + list(root.glob("css/*.css"))
bad = 0
for p in files:
data = p.read_bytes()
for ext, decode in ((".gz", gzip.decompress), (".br", brotli.decompress)):
sib = p.with_name(p.name + ext)
if not sib.exists() or decode(sib.read_bytes()) != data:
bad += 1
print(f"stale {ext}: {p}")
print(f"{len(files)} files checked, {bad} stale siblings")In CI, the dry run can act as a guard. If a commit edits a hashed file without renaming it, the output is anything other than "all hashed assets match their content". The GitHub Actions guide shows how to wire a check like that into a workflow.
The Old Bundle Is Gone
The deploy is an rsync from the repo to the webroot with --delete and an allowlist filter. A file that is no longer in the repo gets deleted from the server on the next deploy, and that is how the old bundles disappeared:
for h in db232882 7ea636b2 f66efe8e; do
curl -s -o /dev/null -w "main.$h.js %{http_code} %{content_type}\n" "https://codertronix.com/js/main.$h.js"
done
curl -sI https://codertronix.com/js/main.7ea636b2.js | grep -i nosniff | tr -d '\r'
Both old names now return 404. The body of that 404 is the site's HTML error page (14,509 bytes of text/html), and the server also sends X-Content-Type-Options: nosniff. MDN says that with nosniff, for a script request, the browser "blocks the response if the MIME type doesn't match" a JavaScript type. An old page that asks for main.7ea636b2.js gets nothing it can run.
On this site that would not blank the page. The HTML and CSS still render and the posts are still readable. What stops working is everything main.js does: the theme toggle, the mobile menu, search, the copy buttons on code blocks and the buttons on the cookie consent banner.

When would an old page still be in use?
Post pages are cached for five minutes with must-revalidate, so on a normal visit the browser checks the HTML and gets the new page. The risky cases are narrower:
- A page fetched in the five minutes before a deploy and reused without a check.
- The homepage, which can be shown stale once during its hour of
stale-while-revalidate. - Back and forward navigation. MDN notes that
must-revalidatedoes not guarantee a check for history navigations. - Crawlers that keep their own copies. Google's guide says its renderer may ignore caching headers.
In most of these cases the old bundle is already in the browser's cache, because the page that named it loaded it with a one-year immutable header. The failure needs an old page and a missing bundle at the same time. That happens when a browser has evicted the bundle but kept the page, when a crawler renders a page it stored earlier, or when a fresh browser opens a page someone saved.
While checking headers I also found that extensionless URLs such as /posts/nginx-configuration came back with no Cache-Control at all. They are answered from location / through try_files and never reach the .html block. With no header, browsers fall back to guessing a lifetime from Last-Modified. web.dev describes that rule as keeping a file "for an additional 10% of its current lifetime." Nothing on the site links to those URLs and the sitemap uses .html, so the gap is small. It was still the kind of gap where an old page lives longer than planned, so on 18 November I added the same five-minute rule to location /.
I also looked at the server's access log to see whether this happens in practice. The current log starts at 00:35 UTC on 17 November. It holds eight requests for the two deleted names, all 404s, and all eight were my own curl checks while writing this post. I have no evidence of a real visitor hitting a deleted bundle. The log also covers less than a day since the latest rename, so that is not proof it never happens.
Keeping the Old File Name for One Deploy
The cheap fix is to delete the old bundle one deploy later instead of right away. That is what the --keep-old flag does. Here it is in the copy, moving from 7ea636b2 back to the real 17 November content:
sed -i 's|"addEventListener", 2.2, function|"addEventListener", 2, function|' site/js/main.7ea636b2.js
uv run -q rehash.py site --keep-old
ls site/js/main.*.js
uv run -q rehash.py site
ls site/js/main.*
The first run renames the bundle, rewrites the 51 pages and keeps the October file. Both bundles sit in js/ and a deploy would ship both, so any page still pointing at 7ea636b2 gets a working script: the new code under the old name. The next run finds the leftover, confirms that no page names it and deletes it, and the deploy after that removes it from the server. At the end, the copy's main.f66efe8e.js was byte-for-byte identical to the one in the repo (cmp reported no difference).
Because the deploy runs with --delete and an allowlist, keeping an old file has to happen in the repo. The server never keeps anything the repo does not have, so keeping the old file is a change you commit and can see in git.
How long to keep it depends on how long an old page can stay in use. With five-minute HTML that is short, and one deploy cycle covers browsers. If a CDN holds your HTML for hours, keep old bundles at least that long. Some sites keep every hashed file forever. For a 78 KB file that is cheap on disk, but this site's allowlist deploy with --delete would need a separate rule for it, and the webroot would no longer match the repo.
The window during the deploy itself
There is a second, shorter window while the rsync runs. Its default delete mode is --delete-during, which removes files directory by directory as it goes, and it puts each updated file in place as it finishes transferring it. During the transfer, a visitor could get a new page before the new bundle has landed, or an old page after the old bundle is gone. I have not measured this window on my deploy, and for a deploy that takes seconds it is small. If you want to close it, the rsync man page has two options. --delete-after moves all deletions to the end. --delay-updates "puts the temporary file from each updated file into a holding directory until the end of the transfer" and then renames them all into place together.
# a variant of the deploy command, not what this site runs today
sudo rsync -av --delete-after --delay-updates --delete-excluded \
--filter='merge nginx/deploy.rsync-filter' \
./ /var/www/codertronix.com/--delay-updates needs room on the server for a second copy of every updated file. On a rename deploy, that means the 51 pages and the bundle, plus their compressed copies.
The Pre-Compressed Copies Rename Too
nginx serves the .br and .gz files directly (gzip_static on and brotli_static on in the main config). Every rename therefore moves three files for the bundle and three for each page. The compressed copies also have to agree with their source. Say index.html.br still names the old bundle after a rename. Every browser that accepts Brotli then gets the old reference even though index.html is correct. That leads to the 404 from the last section, with nothing in the HTML file to explain it. The EC2 deploy post covers the time Brotli was installed but never switched on.
You can see which file nginx sent by looking at the ETag. The bundle served as Brotli had the ETag "6afc15e6-485a". Without Accept-Encoding: br it was "6afc15e6-12f7f". Both are pairs of hex numbers, and here they line up with the files on disk. 0x485a is 18,522, the size of main.f66efe8e.js.br. 0x12f7f is 77,695, the size of the uncompressed bundle. 0x6afc15e6 is 08:52:54 UTC on 17 November, which matches the Last-Modified header and the file's modification time on the server.
That is one reason the script copies the source's modification time onto both compressed files. All three then carry the same time, which is what the gzip_static docs ask for, and the ETags of the three encodings differ only by size. After any rename in the real repo, uv run scripts/compress.py --check exits with status 1 if any compressed copy is stale or orphaned. The verify script above does the same job for the copy.
When Hashing Every File Is Overkill
Only three files on this site are hashed, on purpose. A hash buys a year with no requests, but every change to the file means rewriting every page that links to it. That trade is good for a file that is on every page and must never be served stale. It is poor for a file that rarely changes or appears in only a few places.
comments.js is the example. It is on every post page (38 when I wrote this) and has not changed since 27 October. When it does change, a day of the old widget for some readers is acceptable. With max-age=86400, stale-while-revalidate=604800, a returning reader gets the new file within a day, or on the visit after that if the browser uses its stale copy once while it fetches the new one. Not hashing it means an edit touches one file, not every post page plus two compressed copies of each.
Post images are named after their post and cached for 30 days with no hash. If a hero image is replaced under the same name, some readers can see the old one for up to a month. That is a fair trade for files that rarely change after a post is published.
Fonts were the case to watch. The fonts block sent immutable and a one-year max-age, the same as hashed files, but the font files have plain names like inter-latin.woff2. If I had replaced one with a new subset under the same name, returning visitors could have kept the old one for a year. On 18 November I changed fonts to public, max-age=2592000, stale-while-revalidate=86400: 30 days and no immutable. A replaced font now reaches returning visitors within a month, and a font that has to change sooner still needs a new name.
main.js itself changes more often than it should, because the search index lives inside it. Every new post renames the bundle and rewrites 51 pages. Moving the index into its own file would let me add posts without touching the bundle. It could be a JSON file, which the server already caches for 30 minutes. The site does not do that today, so every post still costs a bundle rename.
Checklist
- The hash in a name is the first 8 hex characters of the SHA-256 of the file's bytes. Check it with
sha256sum. - Hashed CSS and JS get
public, max-age=31536000, immutable, and that location sits before the generic CSS/JS one. - The hash pattern is tight enough that words like
facadedo not match. - HTML gets a short
max-agewithmust-revalidate(orno-cache) and is never immutable. - A rename writes the new file first, then every reference and the compressed copies, and removes the old file last.
- After a rename, a grep for the old name returns zero pages.
- The old file name stays for one deploy when old pages might still be in use.
- After a deploy,
curl -sIshowsimmutableon the new bundle. A curl of the old one confirms whether its 404 is what you intended. - Only files that change often and appear on every page get a hash.
None of this needs a bundler. It takes a hash function, two location blocks and a script that finished in under ten seconds on a copy of this site. For the rest of the nginx setup behind these headers, see the nginx configuration guide.



