Repository navigation
feat: redirect the bare tailnet name to the HTTPS origin for discovery - #3
Merged
Merged
Conversation
The API node now also listens on tailnet port 80 and answers GET and HEAD with a 307 to its HTTPS API origin, keeping the path. Tailscale's search domain resolves the bare machine name (`silo`), but the certificate covers only the full name, so apps can now find the server by probing `http://silo/` and people can type just the machine name. The redirect never proxies, refuses other methods, and a node that cannot open port 80 still serves every listener. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 3, 2026
Merged
Collaborator
Author
|
@macroscope-app review |
Quick104
commented
Oct 3, 2026
Quick104
left a comment
Collaborator
Author
There was a problem hiding this comment.
Inline findings from a code review. The most serious is the redirect host issue on proxy.go:193. Its practical risk is low, but it breaks the guarantee that the redirect can't send a client to another host. I found everything by reading the code; I didn't run the tests.
Review follow-ups: - Build the Location from the parsed origin with only the request's path and query copied in. An absolute-form request line such as "GET http:@evil.example" turned the origin into userinfo and redirected to another host. - Open the port-80 listener without calling Up again, so an optional listener cannot stall the connection loop if the backend leaves Running. - Log a failed discovery listener once and retry it every 30 seconds while connected, including when its server exits. - Add a Discovery setting (on by default) and say in the manifest that the API host answers plain HTTP on port 80 with a redirect. - Tests cover the :80 attempt, close on backend loss, reopen with the new origin after a rename, retry after a failure, discovery off, HEAD, and hostile request lines; the test client has a timeout and its own transport. - Docs: the discovery listener does not gate "connected", the redirect keeps the query, and a stale `silo` machine makes a new node `silo-1`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2 tasks done
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.
Problem
A phone or TV on the tailnet cannot find Silo without being told its full name,
silo.<tailnet>.ts.net. Tailscale's DNS search domain lets a device resolve the bare namesilo, but the node's HTTPS certificate covers only the full name, sohttps://silo/fails and apps cannot use the short name. This makes the API node answer plain HTTP on the bare name with a redirect to its HTTPS origin, so Silo apps can find the server by probinghttp://silo/and a person can type just the machine name.Related: Silo-Server/silo-server#1846 (discovery contract in
docs/architecture/server-discovery.md), Silo-Server/silo-apple#591 (the app side).Approach
GETandHEADwith307to the API listener's HTTPS origin, keeping the path and query. Other methods get405. It never proxies, so no request reaches Silo without TLS. Proxy nodes do not listen: nobody types their names. Discovery off keeps port 80 closed.307rather than a permanent redirect, because the node can be renamed.connected: a failed listen or server exit is logged once and retried every 30 seconds while the node stays connected. It is skipped when a Silo listener already uses port 80.Validation
make checkpasses: unit tests with-race, the patched-Tailscale ACME test,go vet, and gofmt. New tests cover the redirect target, HEAD and hostile request lines, the listener's close and reopen across backend loss and rename, retry after a failed listen, Discovery off, and the setting's parsing.http://<node>/api/v2/system/identityreturned307to the HTTPS origin and the server's identity;POSTreturned405. With the hostname prefix set tosilo, an Apple TV on the tailnet running the feat(onboarding): list Silo servers found on the network and tailnet Silo-Server/silo-apple#591 build listed the server automatically.Risks
AI Disclosure
Up, that failures were silent and never retried, that there was no off switch, and gaps in the docs and tests; all are fixed in the follow-up commit.