feat(infra): unify redirect stack; add www + move beta into doenet.org zone#3012
Open
cqnykamp wants to merge 5 commits into
Open
feat(infra): unify redirect stack; add www + move beta into doenet.org zone#3012cqnykamp wants to merge 5 commits into
cqnykamp wants to merge 5 commits into
Conversation
… zone Generalize redirect.yml into one template that serves both the beta.doenet.org zone redirect and the www.doenet.org single-host redirect, and add the www stack (prod-doenet-www-redirect) that 301s www.doenet.org -> doenet.org so the site keeps a single canonical host. Template changes (redirect.yml): - Add RedirectSubdomains ("true"/"false", default true). true keeps the existing apex + *.<source> behavior with subdomain-label carry; false emits just the single host (no wildcard SAN, no wildcard records) so it is safe to point at a zone that already serves other subdomains. - Rename SourceHostedZoneName -> SourceHost and add RedirectName, a dot-free label used for the per-account-unique CloudFront function name and tags. - The one function body (query-string rebuild + host swap) now lives in a single place instead of being duplicated. Move the beta redirect off its own delegated hosted zone into the doenet.org parent zone (SourceHostedZoneId -> Z08210421B0UEN4PYID0X); beta.doenet.org is a subdomain of doenet.org and only needs a separate zone if delegated, which a dumb redirect no longer warrants. Both redirects now write into the doenet.org zone. Deleting the now-redundant beta.doenet.org hosted zone + its NS delegation is a follow-up (see PR notes) since it is an order-sensitive live DNS change. Deleted redirect-host.yml (folded into redirect.yml). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cqnykamp
force-pushed
the
infra/www-doenet-redirect
branch
from
July 18, 2026 16:40
5497355 to
426b15e
Compare
… zone Generalize redirect.yml into one template that serves both the beta.doenet.org zone redirect and the www.doenet.org single-host redirect, and add the www stack (prod-doenet-www-redirect) that 301s www.doenet.org -> doenet.org so the site keeps a single canonical host. Template changes (redirect.yml): - Add RedirectSubdomains ("true"/"false", default true). true keeps the existing apex + *.<source> behavior with subdomain-label carry; false emits just the single host (no wildcard SAN, no wildcard records) so it is safe to point at a zone that already serves other subdomains. - Replace the source/target params with a single RedirectName label (e.g. "beta", "www") plus the repo-standard PublicHostedZoneName / PublicHostedZoneId (matching the sibling us-east-1 media-cert stack, which also passes them as literals). The source host is derived as <RedirectName>.<PublicHostedZoneName> and the redirect target is the apex PublicHostedZoneName, so neither needs its own param; RedirectName also forms the per-account-unique CloudFront function name and tags. - The one function body (query-string rebuild + host swap) now lives in a single place instead of being duplicated. Move the beta redirect off its own delegated hosted zone into the doenet.org parent zone (SourceHostedZoneId -> Z08210421B0UEN4PYID0X); beta.doenet.org is a subdomain of doenet.org and only needs a separate zone if delegated, which a dumb redirect no longer warrants. Both redirects now write into the doenet.org zone. Deleting the now-redundant beta.doenet.org hosted zone + its NS delegation is a follow-up (see PR notes) since it is an order-sensitive live DNS change. Deleted redirect-host.yml (folded into redirect.yml). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Rename the redirect param files to the <env>-doenet-redirect-<name> stack naming convention and register the beta/www redirect stacks on dev3 for testing (dev3.doenet.org zone Z0066937J8QHRAL9H84P). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # infra/cloudformation/prod-doenet-redirect.params # infra/cloudformation/redirect.yml # infra/prod.aws
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.
What
redirect.ymltemplate that serves both thebeta.doenet.orgzone redirect and a newwww.doenet.orgsingle-host redirect.prod-doenet-www-redirect— 301swww.doenet.org→doenet.org, so the site keeps a single canonical host (consistent with the beta redirect).doenet.orgparent zone. Both redirects now write into thedoenet.orgzone.Template changes (
redirect.yml)RedirectSubdomainsparam ("true"/"false", defaulttrue):true— existing behavior: cover apex +*.<source>, carrying the subdomain label to the target (media.beta.doenet.org→media.doenet.org). RequiresSourceHostto be a zone apex.false— single host only: no wildcard SAN, no wildcard records. Safe to point at a zone that already serves other subdomains (that's whywwwuses it — its zone isdoenet.org, which also holdsmedia.,api., etc.).RedirectName(beta/www) + the repo-standardPublicHostedZoneName/PublicHostedZoneId(as literals, matching the sibling us-east-1prod-doenet-media-certstack) +RedirectSubdomains. The source host is derived as<RedirectName>.<PublicHostedZoneName>and the redirect target is the apexPublicHostedZoneName, so neither needs its own param;RedirectNamealso forms the per-account-unique CloudFront function name + tags. (Assumes each redirect source is a subdomain of the target apex — true forbeta/www; a cross-domain redirect would reintroduce an explicit source-host param.)redirect-host.yml.prod-doenet-www-redirectis registered inprod.aws(STACKS,STACK_REGION=us-east-1,STACK_ORDER) and both params files now pointSourceHostedZoneIdat thedoenet.orgzoneZ08210421B0UEN4PYID0X.Deploy — order-sensitive, do NOT just
aws-deploy.sheverything1.
wwwredirect (safe, new, no existing DNS): deployprod-doenet-www-redirect. ACM validates against thedoenet.orgzone automatically. Pre-check: no existingwww.doenet.orgrecord collides.2. Beta zone move (live DNS — needs care). The beta redirect currently answers via the delegated
beta.doenet.orgzone (Z0126382…). This PR makes CloudFormation manage the beta records in thedoenet.orgparent zone instead. Because DNS delegation is binary, moving records between zones is not gapless by default — while thebeta.doenet.orgNS delegation still exists indoenet.org, parent-zone records forbeta.*are shadowed; once the beta stack update deletes the child-zone records,beta.doenet.orgstops resolving until the delegation is removed.Recommended sequence, in a short planned window (only legacy redirect traffic is affected):
prod-doenet-redirectstack (writes beta apex+wildcard records + cert-validation CNAME into thedoenet.orgzone). The beta ACM cert keeps the same DomainName/SANs, so it is not replaced.beta.doenet.orgNS delegation record from thedoenet.orgzone → resolution flips to the parent-zone records (same CloudFront target).curl -sI https://beta.doenet.org/fooand a*.beta.doenet.orghost both still301todoenet.org.beta.doenet.orghosted zone (Z0126382…).Verify in the Route 53 console before executing step 1/2: confirm whether Route 53 permits creating the
beta.*alias records in the parent zone while the NS delegation still exists (it may require removing the delegation first). If it does, swap steps 1 and 2 and accept a brief TTL-bounded blip. I couldn't check this from the sandbox (no AWS access).Notes
🤖 Generated with Claude Code