Redirect bare private host apex to hexpm_url#118
Merged
Conversation
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.
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.
hexorgs.pm(prod) andstaging.hexorgs.pm(staging) have no apex DNS record today and currently fall through to the subdomain validator's:errorbranch when reached. Add an explicit branch at the top ofrun/2: ifconn.host == private_host, 301 to the configuredhexpm_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
localhostis rewritten to assert the new 301 behaviour (test config has:private_hostset tolocalhost, so barelocalhostis 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.