From ba31359c888205811d77293bd3ec1dc25326a413 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 07:43:21 -0700 Subject: [PATCH 1/3] Confirm the Proxy Headers Before Calling a Run Proxied After a hostname flips to proxied, the local resolver kept answering with the origin for minutes, so a live check in that window measures the origin rather than Cloudflare. Co-Authored-By: Claude Opus 5.5 --- OPERATIONS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OPERATIONS.md b/OPERATIONS.md index 938eb05d..715d915a 100644 --- a/OPERATIONS.md +++ b/OPERATIONS.md @@ -131,6 +131,12 @@ The deploy root and the base URL are the only host-specific values. A local run **Production's deploy checks a sample of the contract, and every other run checks all of it.** The production edge bans a client that requests more than 40 distinct pages in a burst. It also bans one when more than 10 distinct pages answer `404`, `403` or `400`. A full run from the GitHub runner therefore gets it banned. The deploy hook sets `SAMPLE_CONTRACT=1` for `production` alone, and the check then requests one URL from each class. That covers each redirect class, each shape of page that must render, each media tree, and the family pages. It also covers `/all/`, `/feed.xml`, and `/sitemap.xml`, the fixed redirect destinations no list names. The script holds that to 30 distinct pages at most, and none is expected to answer an error. Staging and the local mirrors keep the whole contract, which is where it is proven. **A hand run against the VPS production site sets `SAMPLE_CONTRACT=1` too**, for the same reason the hook does. The local production mirror sits behind no such edge and keeps the whole contract. `checks/check-live-urls.sh --print-sample` lists what a sampled run requests without requesting anything. [`deploy/README.md`](./deploy/README.md#environment-variables) carries the budget. +**A run counts as measured through Cloudflare only once the target answers `server: cloudflare` with a `cf-ray` header.** Right after a hostname flips to proxied, the local resolver can keep answering with the origin for minutes. DNS over HTTPS already answers with Cloudflare by then. A run in that window measures the origin directly, so read those headers before the run: + +```sh +curl -sSI https:/// | grep -iE '^(server|cf-ray):' +``` + **Always set `SITE_BASE_URL` for anything that is not production.** The base URL is baked into the canonical tag, the feed links, and every absolute permalink, so a mirror built without it serves pages that all point back at the production address. Nothing downstream catches this, because the pages render at the right paths and the build gate passes. `make-release.sh` bridges it to Hugo's own `HUGO_BASEURL` internally, and the effective value is printed on every build for that reason. **Never promote a staging build to production.** The base URL is baked into the canonicals, the feeds, and every absolute permalink at build time. A staging artifact served as production points every page at the staging host. Each environment's deploy builds its own release from the ref instead. From 079ba9fa61c5de030de738ff0f54d68c4b6a6647 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 07:46:30 -0700 Subject: [PATCH 2/3] Scope the Proxy Header Check to a Hand Run on the Checking Machine Co-Authored-By: Claude Opus 5.5 --- OPERATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OPERATIONS.md b/OPERATIONS.md index 715d915a..9ebd363f 100644 --- a/OPERATIONS.md +++ b/OPERATIONS.md @@ -131,7 +131,7 @@ The deploy root and the base URL are the only host-specific values. A local run **Production's deploy checks a sample of the contract, and every other run checks all of it.** The production edge bans a client that requests more than 40 distinct pages in a burst. It also bans one when more than 10 distinct pages answer `404`, `403` or `400`. A full run from the GitHub runner therefore gets it banned. The deploy hook sets `SAMPLE_CONTRACT=1` for `production` alone, and the check then requests one URL from each class. That covers each redirect class, each shape of page that must render, each media tree, and the family pages. It also covers `/all/`, `/feed.xml`, and `/sitemap.xml`, the fixed redirect destinations no list names. The script holds that to 30 distinct pages at most, and none is expected to answer an error. Staging and the local mirrors keep the whole contract, which is where it is proven. **A hand run against the VPS production site sets `SAMPLE_CONTRACT=1` too**, for the same reason the hook does. The local production mirror sits behind no such edge and keeps the whole contract. `checks/check-live-urls.sh --print-sample` lists what a sampled run requests without requesting anything. [`deploy/README.md`](./deploy/README.md#environment-variables) carries the budget. -**A run counts as measured through Cloudflare only once the target answers `server: cloudflare` with a `cf-ray` header.** Right after a hostname flips to proxied, the local resolver can keep answering with the origin for minutes. DNS over HTTPS already answers with Cloudflare by then. A run in that window measures the origin directly, so read those headers before the run: +**A hand run counts as measured through Cloudflare only once the target answers `server: cloudflare` with a `cf-ray` header.** Right after a hostname flips to proxied, the resolver on the machine running the check can keep answering with the origin for minutes. Another resolver can already answer with Cloudflare by then. A run in that window measures the origin directly, so read those headers from the same machine before the run: ```sh curl -sSI https:/// | grep -iE '^(server|cf-ray):' From 77eb03f6f1c82597af63098cf2b9cddf1bcbb0c3 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sat, 24 Oct 2026 07:53:14 -0700 Subject: [PATCH 3/3] Ignore a Local curlrc in the Proxy Header Probe Co-Authored-By: Claude Opus 5.5 --- OPERATIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OPERATIONS.md b/OPERATIONS.md index 9ebd363f..e69ea26f 100644 --- a/OPERATIONS.md +++ b/OPERATIONS.md @@ -134,7 +134,7 @@ The deploy root and the base URL are the only host-specific values. A local run **A hand run counts as measured through Cloudflare only once the target answers `server: cloudflare` with a `cf-ray` header.** Right after a hostname flips to proxied, the resolver on the machine running the check can keep answering with the origin for minutes. Another resolver can already answer with Cloudflare by then. A run in that window measures the origin directly, so read those headers from the same machine before the run: ```sh -curl -sSI https:/// | grep -iE '^(server|cf-ray):' +curl -q -sSI https:/// | grep -iE '^(server|cf-ray):' ``` **Always set `SITE_BASE_URL` for anything that is not production.** The base URL is baked into the canonical tag, the feed links, and every absolute permalink, so a mirror built without it serves pages that all point back at the production address. Nothing downstream catches this, because the pages render at the right paths and the build gate passes. `make-release.sh` bridges it to Hugo's own `HUGO_BASEURL` internally, and the effective value is printed on every build for that reason.