Repository navigation
feat(cli): domain set --redirect for hosts that 301 to the site's domain - #60
Merged
Merged
Conversation
`cloudhal domain set example.com --redirect www.example.com` records the redirect hosts in cloudhal.json (`domains.redirects`). The next deploy routes them to the site Worker as Custom Domains (so Cloudflare creates the DNS records and certificates) and names them in CLOUDHAL_REDIRECT_HOSTS / CLOUDHAL_REDIRECT_TO; the Worker answers them with a 301 to the site's domain, path and query kept, before picking a site. `domain remove redirects` drops them; removing the site domain drops them too. Closes #49 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
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.
Closes #49.
cloudhal domain set example.com --redirect www.example.com(repeatable, or comma-separated):cloudhal.json→domains.redirects.cloudhal deployroutes each host to the site Worker as a Cloudflare Custom Domain (DNS record and certificate created by Cloudflare) and setsCLOUDHAL_REDIRECT_HOSTS/CLOUDHAL_REDIRECT_TO.301tohttps://<site domain><path><query>(packages/astro-renderer/src/host-redirect.ts).cloudhal domain remove redirectsdrops them; removing the site domain drops them too (nowhere to go). A redirect host equal to the site's or Studio's domain is refused.This replaces the hand-made Cloudflare Redirect Rule cloudhal.com uses for
www.Tests:
host-redirect.test.ts(301, path/query kept, other hosts untouched);deploy.test.tschecks validation, the routes and the vars in the generatedwrangler.jsonc.🤖 Generated with Claude Code