fix: support multi-segment custom TLDs#277
Open
KingPsychopath wants to merge 1 commit intovercel-labs:mainfrom
Open
fix: support multi-segment custom TLDs#277KingPsychopath wants to merge 1 commit intovercel-labs:mainfrom
KingPsychopath wants to merge 1 commit intovercel-labs:mainfrom
Conversation
|
@KingPsychopath is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
3ab16a6 to
1a9b34b
Compare
Author
|
Marked ready for review. This keeps the scope focused on multi-segment |
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.
Summary
Refs #260.
Allow custom TLDs to be multi-segment DNS suffixes such as
local.example.devordev.example.com.This means users can now run:
portless --tld local.example.dev run --name myapp vite dev # https://myapp.local.example.devThe change also keeps the app name clean. The previous workaround was to use a single final label as
PORTLESS_TLDand put the rest of the domain into the app name, for examplePORTLESS_TLD=devwith--name myapp.local.example. That can produce a usable URL, but it treats domain structure as app naming. This PR makes the configured TLD itself multi-segment.Context
Related issues and discussions:
app.dev.example.com. This PR addresses the core validation, parsing, routing, and SNI certificate support. It does not implement the optional single-wildcard-cert mode discussed there..localhostredirect URIs #58 covers the Google OAuth callback problem with.localhoststyle origins. Multi-segment TLDs let users point OAuth providers at a domain they own, such ashttps://myapp.local.example.dev/api/auth/callback/google.What Changed
validateTldto accept dot-separated DNS labels.--tldin run mode and named app mode, including leading placement beforerunor the app name.PORTLESS_TLDthrough proxy start config.skills/portless/SKILL.md, andskills/oauth/SKILL.md.Certificate Behavior
#260 mentions a possible single wildcard cert for
*.dev.example.com. This PR does not add a new wildcard-cert mode.Instead, it keeps the existing SNI certificate strategy and verifies that multi-segment TLD app hosts get a valid per-host certificate. For example,
myapp.local.example.devreceives SANs like:That keeps the fix focused while covering browser and curl hostname validation for the actual app URL.
Hosts Resolution
Existing per-host
/etc/hostssync continues to work unchanged: each registered app writes its full<app>.<tld>entry. Users withPORTLESS_SYNC_HOSTS=0can still use DNS they control or explicit resolver overrides. The manual smoke test usedcurl --resolveto verify the proxy path without mutating the hosts file.Validation
pnpm --filter portless type-checkpnpm testcurl --cacert ... --resolve myapp.local.example.dev:<port>:127.0.0.1 https://myapp.local.example.dev:<port>/checkTrimmed smoke-test output:
The manual smoke test verified route registration,
PORTLESS_URL, HTTPS proxying, and the generated certificate SAN for a multi-segment TLD.