Serve .well-known from an undotted origin path - #111
Merged
Merged
Conversation
Both /.well-known/ URLs 404'd in production after #108 merged and deployed green. actions/upload-pages-artifact builds its tarball with a hardcoded `--exclude=.[^/]*`, so site/.well-known/ never entered the artifact. Confirmed against the Pages origin directly: /context.jsonld 200, /.well-known/* 404 — the Worker was faithfully proxying a file that was never uploaded. The build now emits site/well-known/ and the Worker rewrites /.well-known/<x> onto it. The canonical, RFC-mandated URL is unchanged, which is the only address RFC 8615 and RFC 9116 care about; the Pages origin is never advertised, so its internal layout is ours to choose. Rewriting a URI onto an origin file is what this Worker is for, so this costs no new machinery — the alternative, replacing upload-pages-artifact with a hand-rolled tar, would put the deploy path's correctness in our hands to save a directory name nobody sees. Two guards, because the existing build test asserted the output path and passed while the site was 404ing: - a build test asserting nothing under site/ starts with a dot, which catches the whole class rather than these two files - a post-deploy smoke step curling the canonical URLs, so a silently truncated artifact fails the run instead of looking like a successful deploy. It uses curl -f with retries: the Worker caches its own 404 for 60s, so the first probe after a deploy can legitimately still miss. Closes #110
This was referenced Sep 13, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
https://material-identity.eu/.well-known/security.txtand.../pgp-security.ascreturned 404 after #108 merged and deployed green.actions/upload-pages-artifactbuilds its tarball with a hardcoded--exclude=.[^/]*, sosite/.well-known/never entered the artifact. Not an input we can flip —include-hidden-filesgoverns the upload of the tar, not what goes into it. Confirmed against the Pages origin directly, which rules out the Worker:/.well-known/security.txt/.well-known/pgp-security.asc/context.jsonld/index.htmlThe Worker was faithfully proxying a file that was never uploaded.
Fix
scripts/build.tsemitssite/well-known/(undotted). The tracked source stays at.well-known/in the repo root — that is the convention, and it is what a repo-root consumer expects.worker/index.tsrewrites/.well-known/<x>onto/well-known/<x>, content types and the 1-day ceiling unchanged.The public URL is untouched:
https://material-identity.eu/.well-known/security.txtis the only address RFC 8615 and RFC 9116 care about. The Pages origin is never advertised (deploy.ymlsays as much), so its internal layout is ours to choose, and mapping a URI onto an origin file is exactly this Worker's job.Rejected: replacing
upload-pages-artifactwith a hand-rolledtar+upload-artifact. Tidier origin layout, but it moves the deploy path's correctness into our hands for the sake of a directory name nobody sees.Two guards
The build test we already had asserted the output path — and passed, green, while production 404'd. Asserting the same fact more loudly would not have helped, so both guards move outward:
site/may start with a dot. Catches the whole class, not these two files.deploy.yml: curls the canonical URLs and fails the run on a non-200, so a silently truncated artifact can no longer look like a successful deploy. Usescurl -fwith retries, because the Worker caches its own 404 for 60s and the first probe after a deploy can legitimately still miss.Closes #110
Test plan
npm test— 80/80npm run validate— OKnpm run build— emitssite/well-known/, no dot-entries anywhere in the treeimmutable, nested.well-knownpaths rewritten, and an assertion that no origin path we produce contains/.deploy.ymlparses