Switch to per-package subdomains and drop public-host redirect#117
Merged
Conversation
`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.
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.
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/3now emitshttps://PACKAGE.hexdocs.pm/pathfor the hexpm repo. The sitemap intentionally keeps apex URLs (https://hexdocs.pm/PACKAGE/...) via a newhexdocs_apex_url/1helper 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.pmredirect 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).