Skip to content

fix: point HTTPS and Funnel serves at the target's SSL leg (1.104.4:0 → 1.104.4:1) - #24

Merged
MattDHill merged 1 commit into
masterfrom
fix/https-serve-forwarded-proto
Nov 6, 2026
Merged

MattDHill merged 1 commit into
masterfrom
fix/https-serve-forwarded-proto

Conversation

@MattDHill

Copy link
Copy Markdown
Member

Closes #23.

Tailscale's serve proxy already sets X-Forwarded-Proto: https and X-Forwarded-Host (ipn/ipnlocal/serve.go, addProxyForwardedHeaders). The header was lost one hop later: whenever the target interface had a plaintext scheme, targetSchemeFor pointed the route's forwarder at the target's plaintext bridge port. StartOS's proxy on that leg strips every incoming X-Forwarded-* header and adds no proto (start-core net/http.rs, apply_request_policy). Nextcloud, which reads the scheme per request, therefore saw http and built http:// redirects and CalDAV/CardDAV discovery URLs, which the HTTPS serve answers with 400.

https and funnel routes now prefer the target's SSL bridge leg (https+insecure) when the interface has one, where StartOS sets X-Forwarded-Proto: https. http routes keep the plaintext leg, and an interface with only one leg is served as before. The actions' "can this be served" check is unchanged.

  • README describes which leg each mode forwards to.
  • Revision 1.104.4:1 with release notes; 1.104.4:0 is already on community-prod.

Verified: tsc --noEmit and Prettier pass. Not exercised on a box: no Nextcloud and tailnet test setup was at hand, so the serve change is unverified end to end. The SDK pin stays at 3.1.1 (4.0.0 is out); the major bump is left out of this fix.

🤖 Generated with Claude Code

… → 1.104.4:1)

Tailscale's serve proxy sets `X-Forwarded-Proto: https`, but the route
forwarded to the target's plaintext bridge port whenever the interface
had one. StartOS's proxy on that leg strips every incoming
`X-Forwarded-*` header and adds no proto, so Nextcloud saw http and
built `http://` redirects and CalDAV/CardDAV discovery URLs, which the
HTTPS serve rejects with 400.

`targetSchemeFor` now prefers the SSL bridge leg (`https+insecure`) for
TLS serve modes; StartOS sets `X-Forwarded-Proto: https` there. HTTP
routes keep the plaintext leg.

Closes #23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MattDHill
MattDHill requested a review from helix-white November 6, 2026 18:51

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the routing change and its callers: HTTPS/Funnel prefer the SSL bridge leg, HTTP retains plaintext preference, single-leg fallbacks and TCP behavior remain unchanged, and action eligibility is unaffected. This matches StartOS's documented forwarded-header policy. No correctness regressions found; the head merges cleanly into master and all three reported CI checks passed.

Code review only; end-to-end Nextcloud/tailnet behavior remains unverified as disclosed in the PR.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@MattDHill
MattDHill merged commit a606912 into master Nov 6, 2026
3 checks passed
@MattDHill
MattDHill deleted the fix/https-serve-forwarded-proto branch November 6, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

HTTPS serve doesn't pass X-Forwarded-Proto: https, so Nextcloud's redirects come out http://

2 participants