Skip to content

fix: Tailscale sidecar host connectivity - #9

Merged
aterrylu merged 1 commit into
mainfrom
terry/project-session-view
Mar 8, 2026
Merged

fix: Tailscale sidecar host connectivity#9
aterrylu merged 1 commit into
mainfrom
terry/project-session-view

Conversation

@aterrylu

@aterrylu aterrylu commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • host.docker.internal resolution: Added extra_hosts: host-gateway to docker-compose so the Tailscale sidecar can reach the host machine
  • Vite allowed hosts: Set allowedHosts: true so requests proxied through Tailscale serve aren't rejected by Vite's host check

Without these, http://autonomos returns 502 (container can't reach host) or 403 (Vite rejects the hostname).

Test plan

  • docker exec autonomos-ts wget http://host.docker.internal:5173/ returns HTML
  • curl http://autonomos/ returns 200
  • Access http://autonomos from phone on tailnet

🤖 Generated with Claude Code

- Add extra_hosts: host-gateway so container can resolve host.docker.internal
- Set allowedHosts: true in Vite config so Tailscale serve proxy isn't blocked

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aterrylu
aterrylu enabled auto-merge (squash) March 8, 2026 20:50
server: {
host: "0.0.0.0",
allowedHosts: ["aterrylu-macbook-pro"],
allowedHosts: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟢 Suggestion

Problem: allowedHosts: true disables Vite's host-check entirely rather than allowlisting the specific Tailscale hostname(s).

Why it matters: Vite's host check is a DNS rebinding guard. true silences it for any hostname, so if another device on the tailnet serves a page that makes requests to http://autonomos, Vite will happily serve them. Low risk on a personal tailnet, but worth tightening.

Suggested fix:

// Add the Tailscale machine name (or MagicDNS hostname) explicitly
allowedHosts: ["autonomos", "autonomos.your-tailnet.ts.net"],

If you want a catch-all for all *.ts.net domains you could also use a regex, but the explicit list is simplest here.

@nox-0x nox-0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Solid fix — host-gateway extra_hosts is the right way to bridge Tailscale sidecar → host. Left one suggestion on allowedHosts: true (consider allowlisting the specific Tailscale hostname instead of disabling the guard entirely), but nothing blocking. Ship it.

@aterrylu
aterrylu merged commit ad1686b into main Mar 8, 2026
1 check passed
@aterrylu
aterrylu deleted the terry/project-session-view branch March 8, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants