docs(custom-domains): name the ordering trap in the II pitfall - #341
Merged
Conversation
Pitfall 9 described the symptom (II principals change with the origin) and pointed at internet-identity for the fix, but omitted the part that decides whether the fix is still available: it has to happen before the domain collects sign-ins. Once accounts exist under the new domain, repointing it at a derivation origin orphans them. Also names the canister address as the origin to pin, so the reader is not left to pick, and drops the "switching from a canister URL" framing — the canister address does not go away when a custom domain is added. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Skill Validation ReportValidating skill: /home/runner/work/icskills/icskills/skills/custom-domainsStructure
Frontmatter
Markdown
Tokens
Content Analysis
Contamination Analysis
Result: passed Project Checks |
marc0olo
added a commit
that referenced
this pull request
Aug 10, 2026
… origin (#339) # Motivation The skill only mentioned `derivationOrigin` and `ii-alternative-origins` in Pitfall 8, to say don't use them. That is right for the `icp0.io` vs `ic0.app` case it covers, but it was the whole coverage, so an agent adding a custom domain to an II app found a prohibition and no recipe. `custom-domains` Pitfall 9 already pointed here for one. The engine console started surfacing this in dfinity/control-panel#3394 and dfinity/control-panel#3398. # Changes - Added a "Serving an app at more than one origin" section: pick the canister address as the derivation origin, set `derivationOrigin` on the alternative origin only, and serve `.well-known/ii-alternative-origins` from the derivation origin's canister. - Added the `_headers` block the `@dfinity/static-site` recipe needs. The [official docs](https://docs.internetcomputer.org/building-apps/authentication/alternative-origins) say to use `.ic-assets.json5`, which is the legacy asset canister's config — static-site does not read or upload it. The file also has no extension, so it will not serve as `application/json` without a `_headers` entry, and certified-assets sets no CORS header by default. - Scoped Pitfall 8 to the `icp0.io`/`ic0.app` case and pointed it at the new section. - Added one eval case. Dropped a second one I drafted ("which origin gets `derivationOrigin`") because the baseline scored 3/3 on it — it tested common knowledge, not the skill. <details> <summary>Eval 14 — Adversarial: alternative origins on the static-site recipe (WITH 3/3 | WITHOUT 2/3)</summary> ``` ━━━ Adversarial: alternative origins on the static-site recipe ━━━ WITH skill: 3/3 passed ✅ Serves .well-known/ii-alternative-origins containing {"alternativeOrigins": [...]} ✅ Adds a _headers entry setting Content-Type: application/json AND Access-Control-Allow-Origin: * for /.well-known/ii-alternative-origins ✅ Does NOT create a .ic-assets.json5 file WITHOUT skill: 2/3 passed ✅ Serves .well-known/ii-alternative-origins containing {"alternativeOrigins": [...]} ❌ Adds a _headers entry setting Content-Type: application/json AND Access-Control-Allow-Origin: * for /.well-known/ii-alternative-origins → No _headers file or entry is included anywhere in the output. ✅ Does NOT create a .ic-assets.json5 file ``` The baseline writes the JSON file and stops, which leaves it served with the wrong content type and no CORS header. </details> --- Next #340, #341 --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Marco Walz <marco.walz@dfinity.org>
marc0olo
approved these changes
Aug 10, 2026
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.
Motivation
Pitfall 9 described the symptom — II principals depend on the origin, so a custom domain changes them — and pointed at
internet-identityfor the fix. It left out the part that decides whether the fix is still available: it has to happen before the domain collects sign-ins. Once accounts exist under the new domain, repointing it orphans them. That ordering is what the engine console now warns about on the add-domain form (dfinity/control-panel#3394).Changes
Eval 9 — Adversarial: custom domain on an app that already has II users (WITH 4/4 | WITHOUT 2/4)
The baseline knows principals are per-origin but gives half the fix —
ii-alternative-originswithoutderivationOrigin— which on its own does nothing.Prev. #339