Skip to content

Support remote access from mobile/LAN (Tailscale, phone, etc.) #107

@sokol-matija

Description

@sokol-matija

Use Case

When working away from my desktop, I want to monitor Claude Code sessions from my Android phone (or any device) over Tailscale. The devtools UI is perfectly suited for mobile monitoring but currently only works on localhost.

Root Cause

The Electron HTTP server hardcodes 127.0.0.1 with no way to override it, and CORS blocks non-localhost origins:

src/main/services/infrastructure/HttpServer.ts

// Default bind — no env/config override in Electron path
host: string = '127.0.0.1'

// CORS only allows localhost origins
const localhostPattern = /^https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?$/;

Note: the standalone/Docker path already works correctly — it defaults to HOST=0.0.0.0 and CORS_ORIGIN=*.

src/renderer/components/settings/sections/GeneralSection.tsx

const serverUrl = `http://localhost:${serverStatus.port}`;

This "copy URL" display always shows localhost even if the server is bound to another interface.

Proposed Fix

1. Respect a HOST env var in the Electron app's server start (same pattern as standalone):

// src/main/index.ts (or wherever httpServer.start() is called in Electron)
const host = process.env.HOST ?? '127.0.0.1';
await httpServer.start(services, modeSwitchHandler, 3456, host);

2. Relax CORS when HOST is set to a non-localhost value:

const host = process.env.HOST ?? '127.0.0.1';
if (host !== '127.0.0.1' && host !== 'localhost') {
  process.env.CORS_ORIGIN = process.env.CORS_ORIGIN ?? '*';
}

3. Fix the displayed URL in GeneralSection.tsx to use the actual bound host instead of hardcoded localhost.

Workaround Attempted

  • Caddy reverse proxy with header_up Host localhost on port 3457 → page loads but spins forever
  • Root cause: src/renderer/api/index.ts correctly uses window.location.origin for standalone, but Electron opens the browser with ?port=XXXX which triggers the http://127.0.0.1:${port} code path — so the remote browser tries to connect to its own 127.0.0.1, not the server's

Environment

  • macOS (darwin), Electron app
  • Tailscale network, accessing from Android phone
  • http://<tailscale-hostname>:3456 — page loads, spins forever

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions