Skip to content

Switch to per-package subdomains and drop public-host redirect#117

Merged
ericmj merged 2 commits into
mainfrom
hexdocs-subdomain-cleanup
May 29, 2026
Merged

Switch to per-package subdomains and drop public-host redirect#117
ericmj merged 2 commits into
mainfrom
hexdocs-subdomain-cleanup

Conversation

@ericmj
Copy link
Copy Markdown
Member

@ericmj ericmj commented May 28, 2026

Step 1 of the HexDocs subdomain migration (Phase 1, rollout step 1). Safe to ship before any DNS or Fastly work — until the DNS flip lands, the dropped redirect arm is dead code on the public host.

Hexdocs.Utils.hexdocs_url/3 now emits https://PACKAGE.hexdocs.pm/path for the hexpm repo. The sitemap intentionally keeps apex URLs (https://hexdocs.pm/PACKAGE/...) via a new hexdocs_apex_url/1 helper so Googlebot follows the apex 301 chain to discover subdomain URLs as canonical — avoids needing per-subdomain sitemaps + robots.txt.

The Plug-level *.hexdocs.pm -> *.hexorgs.pm redirect arm is removed. The Fastly Compute service will own that redirect after the DNS flip. This app's only remaining job is serving *.hexorgs.pm (private/org docs behind OAuth).

Related: hexpm#1605 (Phase 0 denylist).

ericmj added 2 commits May 28, 2026 22:32
`Hexdocs.Utils.hexdocs_url/3` now emits `https://PACKAGE.hexdocs.pm/path`
for the hexpm repo. The sitemap keeps apex URLs via a new
`hexdocs_apex_url/1` helper so Googlebot still discovers packages via
the apex 301 chain.

The Plug-level `*.hexdocs.pm -> *.hexorgs.pm` redirect arm is removed.
The Fastly Compute service will handle that redirect once the DNS flip
lands; this app now only serves the `*.hexorgs.pm` (private/org) path.
Hex package names allow underscores (^[a-z][a-z0-9_]*$). RFC 1123
hostname labels and RFC 6125 wildcard SAN matching don't, and Fastly
enforces strict SAN matching at the HTTP edge — phoenix_live_view.hexdocs.pm
returns 421 'Misdirected Request' even though the wildcard cert
technically covers *.hexdocs.pm.

Hexdocs.Utils.hexdocs_url/3 for the hexpm-repo branch now maps _ -> -
when building the subdomain. The mapping is reversed in the Fastly
Compute subdomain handler before building the GCS bucket key, so
canonical hex names continue to be the storage key.

The org-repo branch is unchanged: org subdomains live under hexorgs.pm,
which still A-records to GKE and doesn't enforce strict SAN matching.

Queue test updated for the new URL shape.
@ericmj ericmj merged commit a71b23b into main May 29, 2026
12 checks passed
@ericmj ericmj deleted the hexdocs-subdomain-cleanup branch May 29, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant