Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.

Redirect bare private host apex to hexpm_url - #118

Merged
ericmj merged 1 commit into
mainfrom
redirect-hexorgs-apex
May 29, 2026
Merged

ericmj merged 1 commit into
mainfrom
redirect-hexorgs-apex

Conversation

@ericmj

@ericmj ericmj commented May 29, 2026

Copy link
Copy Markdown
Member

hexorgs.pm (prod) and staging.hexorgs.pm (staging) have no apex DNS record today and currently fall through to the subdomain validator's :error branch when reached. Add an explicit branch at the top of run/2: if conn.host == private_host, 301 to the configured hexpm_url.

prod: hexorgs.pm -> https://hex.pm
staging: staging.hexorgs.pm -> https://staging.hex.pm

The previous "requests without subdomain not supported" test on bare localhost is rewritten to assert the new 301 behaviour (test config has :private_host set to localhost, so bare localhost is the private-host-apex case).

Depends on a Cloudflare DNS record being added for the hexorgs.pm apex (and staging.hexorgs.pm) pointing at the GKE ingress so requests reach the app. That goes in a separate hexpm-ops PR.

Hitting hexorgs.pm with no subdomain previously hit subdomain/1's
default :error branch and returned 400. The natural UX is to land
users on hex.pm instead. Same in staging — staging.hexorgs.pm
redirects to https://staging.hex.pm.

Depends on a Cloudflare DNS record being added for the hexorgs.pm
apex to point at the GKE ingress so requests actually reach the app.
@ericmj
ericmj merged commit d9ceaf4 into main May 29, 2026
12 checks passed
@ericmj
ericmj deleted the redirect-hexorgs-apex branch May 29, 2026 13:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant