Engineering Guide

Verifying a Static Site Release

Hash the build output, hash the bodies served at the live URLs, and confirm that they match; then check status codes, headers, redirects, and internal links. The release is proven only when the deployed bytes and URLs are the ones the build produced.

A static site release is verified when the bytes served at the live URLs match the bytes produced by the build, and when every internal link resolves to the intended page. A successful upload or a green deploy job is not proof; the check must read from the deployed origin.

The short answer

Keep the build output immutable, generate a manifest of paths and SHA-256 hashes, deploy that exact directory, then fetch the same paths over HTTP and compare body hashes. Alongside hashes, check status codes, Content-Type, cache headers, redirects, and a sample of page content. Finish with a link crawl. Record the commit or build identifier in the output and confirm that identifier at the live URL.

Check Built artifact Deployed site
body bytes sha256sum hash of curl response
status file exists 200 for pages, 404 for missing
type extension Content-Type header
links relative targets exist crawl resolves
version build id file same id served

A minimal example

cd dist
find . -type f -print0 | sort -z | xargs -0 sha256sum > ../manifest.sha256

After uploading the contents of dist to the server's root, compare each entry:

base=https://example.com/
while read -r hash path; do
  remote=$(curl -fsS --compressed "$base${path#./}" | sha256sum | cut -d' ' -f1)
  [ "$hash" = "$remote" ] || echo "MISMATCH $path"
done < manifest.sha256

Check headers and redirect behavior separately:

curl -sS -o /dev/null -D - https://example.com/papers/ | head -n 20
curl -sS -o /dev/null -w '%{http_code} %{redirect_url}\n' https://example.com/papers

Why this happens

Building and deploying are separate state transitions with independent failure modes. An upload can skip a file, a CDN can serve a cached HTML page with new assets, a server can rewrite extensionless URLs, and compression or charset conversion can change bytes. Case-insensitive local filesystems hide broken references that fail on a case-sensitive server. Checking the live response is the only direct evidence that the published artifact is the one that was tested.

If the origin sends validators, verify them too; validating an ETag with curl shows how to compare an ETag with the body it describes.

What changes the answer

  • Compression: hash the decoded body (curl --compressed), and check Content-Encoding deliberately.
  • CDN: purge or bypass the cache; compare origin and edge responses.
  • Redirects: curl -L hides the chain; request each hop without following to see the status and Location.
  • Base path: a site built for /papers/ must be served there; root-absolute links break under a different prefix.
  • Missing pages: some hosts return 200 with a custom error page; require a content marker for 404s.
  • Case: Index.html and index.html are different paths on the server.

Edge cases

Some hosting platforms minify HTML automatically, so disable that or compare normalized output. A service worker can serve an old cached copy inside a browser even when the network is correct. HSTS upgrades are expected redirects, not failures. Signed asset URLs expire and will fail later checks. Builds that embed timestamps differ on every run; set a fixed epoch for reproducible output.

Practical checks

Hash every file, then spot-check titles and unique content markers. Request a known page, a known redirect, and a known missing path, and assert the expected status for each. Run an HTML validator and a link checker against the deployed base URL. Save the manifest, headers, and crawl report as release evidence, and repeat the check after any cache purge.

Sources

Revision history

Published
Updated
— Initial publication.