Skip to content

Serve private docs on hyphenated org subdomains#121

Merged
ericmj merged 1 commit into
mainfrom
org-subdomain-hyphens
Jun 3, 2026
Merged

Serve private docs on hyphenated org subdomains#121
ericmj merged 1 commit into
mainfrom
org-subdomain-hyphens

Conversation

@ericmj

@ericmj ericmj commented Jun 3, 2026

Copy link
Copy Markdown
Member

Org names allow underscores, but RFC 1123 hostname labels and Fastly's strict SAN matching don't, so map _ -> - for *.hexorgs.pm subdomains, mirroring the public package side. The hexorgs.pm path is served by this app rather than Fastly, so the reverse - -> _ mapping and the 301 from the old underscore host both live in the plug.

  • Utils: add name_to_subdomain/1 and subdomain_to_name/1 (replacing package_to_subdomain/1); hexdocs_url/3 now hyphenates the org subdomain.
  • Plug: 301-redirect underscore hosts to the hyphenated host (preserving path and query); reverse-map the subdomain to the org name for the OAuth scope, key verification and bucket key; build the OAuth redirect_uri with the hyphenated host.

Org names allow underscores, but RFC 1123 hostname labels and Fastly's
strict SAN matching don't, so map `_` -> `-` for `*.hexorgs.pm`
subdomains, mirroring the public package side. The hexorgs.pm path is
served by this app rather than Fastly, so the reverse `-` -> `_` mapping
and the 301 from the old underscore host both live in the plug.

- Utils: add name_to_subdomain/1 and subdomain_to_name/1 (replacing
  package_to_subdomain/1); hexdocs_url/3 now hyphenates the org subdomain.
- Plug: 301-redirect underscore hosts to the hyphenated host (preserving
  path and query); reverse-map the subdomain to the org name for the
  OAuth scope, key verification and bucket key; build the OAuth
  redirect_uri with the hyphenated host.
@ericmj ericmj merged commit 093a5f4 into main Jun 3, 2026
12 checks passed
@ericmj ericmj deleted the org-subdomain-hyphens branch June 3, 2026 22:24
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