Back to blog
NO.
037
DATE
Updated
READ
~42 min
KIND
Guide
STATUS
Reviewed

TAGS: AI collaboration Cloudflare

Continue Using Pi from Your Phone

Reach your computer's Pi Web with Tailscale or Cloudflare Tunnel: Windows/WSL setup, restart steps, and privacy boundaries for files and model inputs.

Away from the desk, you want to read the last answer on your phone, add one more instruction, and let the computer keep working. You can do that without renting a server or learning router port forwarding first.

Pi Web is the example here; the same approach works for any web tool already running on your computer. The example setup is Windows + WSL2 (the Linux environment inside Windows) and an Android phone. In that setup Route A works end to end: with Wi-Fi off, the phone opened Pi Web on the computer over mobile data, signed in, saw the sessions and got a reply. Route B has not been tested there yet; it follows the official documentation, and the places to check yourself are marked.

This page is not served to visitors in mainland China.

Pick one route; skip the other

One question: does your phone have to keep another VPN app running while you use Pi Web?

  • No, or you can switch it off for a while: take A: a private Tailscale connection. HTTPS for the remote entry point terminates on your own computer, and you don't need a domain.
  • Yes, it has to stay on: take B: a fixed Cloudflare URL. The phone only needs a browser; the trade-off is that the page content is unwrapped at Cloudflare first, then passed on to your computer.

If "the other VPN app must stay on" and "no third party may unwrap the content" are both hard requirements, neither beginner route meets both. Don't set up B in that case; look at a relay that only forwards ciphertext while your computer handles HTTPS.

In the example setup, the phone has another VPN app installed but rarely uses it. Android allows one active VPN per user profile (Android developer docs), and Tailscale says it can't run alongside other VPNs there, so the two cannot run at the same time. Turn it off to try A; there's no need to uninstall it or switch to different software.

Your own domain is only used in B. A uses the *.ts.net address Tailscale assigns; don't force your domain into it.

For private images, videos or client material, read A4: media and third-party privacy boundaries first. A protects remote transport; it does not prevent endpoint copies, stop an agent reading other files, or hide model inputs from the cloud provider receiving them.

How do the two routes connect, and who can see what?

Think of HTTPS as a sealed envelope: anyone along the way sees the envelope, not the letter. The difference between the routes is where the envelope gets opened.

A: the phone and the computer first set up an encrypted channel that belongs to your devices only, and the keys to it exist only on those two devices. When they can't connect directly, data takes a detour through a Tailscale relay, but the relay has no key and can only pass it along as is (DERP relays). Tailscale's login server only introduces the devices to each other, exchanging public keys and device details (how Tailscale works). The envelope is opened by Serve on your computer and handed to the local Pi Web.

B: cloudflared on your computer connects out to Cloudflare, so the router needs no open ports (Cloudflare Tunnel). When the phone opens the fixed URL, the envelope is opened at Cloudflare; Access checks that it's you, then the content goes into a new envelope and through the tunnel to your computer. Visitor to Cloudflare and Cloudflare to your computer are two separately encrypted connections (Cloudflare encryption modes).

A: TailscaleB: Cloudflare
Who can open itOnly devices in the same tailnet (Tailscale private network) permitted by its access control policyAnyone reaches the door; only you get past Access
Unwrapped atYour computerAt Cloudflare first, then your computer
Provider knowsAccount, devices and who connected to whom; logs hold no traffic contentAccount, sign-in records, and the page content passing through
Once insidePi Web still asks for its passwordPi Web still asks for its password

The Pi Web password is a second lock: if someone gets hold of a device or an access rule is misconfigured, it still stands in the way. It doesn't encrypt the connection itself, and Pi Web's README asks for remote use to sit behind HTTPS or a trusted VPN (Pi Web README); both routes do that.

Only need to click something on the computer now and then? A remote desktop app works too

Yes. Install the vendor's app on the computer and the phone, bind your own devices, and control Pi Web on the computer from the phone. You usually don't need the web entry point from this guide, and remote desktop apps typically don't take the phone's single VPN slot; check your version, and note that another VPN app's routing rules can still affect the connection.

They feel different. Remote desktop streams the computer's screen and input, so it can deal with desktop dialogs or restart an app. The phone web page lays the conversation out for a phone screen, which suits long reading and typing. Remote desktop also tends to use more bandwidth at high quality or with a busy screen, and depends on the computer's resolution.

A remote desktop grant usually covers the whole computer. Protect the account, turn on two-step verification where offered, and don't share connection codes; switch off file transfer, clipboard sync and unattended access if you don't use them. "Encrypted" or "privacy screen" on a vendor page does not prove the relay cannot decrypt; this guide has not verified any vendor's encryption design or ranked latency.

If you already have a remote desktop tool you trust, keep it as a backup way to restart services on the computer; there's no need to install several. Unless you have wake-on-LAN set up, it can't reach a computer that is off or offline either.

Before you leave: check the computer opens it

On the computer running the web tool, open its local address. For Pi Web the default is:

http://127.0.0.1:30141

Continue only once the page loads. If it doesn't open locally, fix the local service first; a tunnel won't repair a broken app. On a phone, 127.0.0.1 means the phone itself, so this address can't be copied over as is.

If this is your first Pi Web install, check the Node.js version against the official instructions and install the published package globally. For everyday remote use, don't swap in a development server.

First install / WSL users: expand this step

The initial connection used Pi Web 0.12.2; the security review on November 1, 2026 checked a running 0.13.0 instance. The command below pins that reviewed version and requires Node.js 22.19.0 or newer. Installation and upgrading were not retested in that review. Even for a local first run, set a password before starting: an existing reverse proxy may already point at this port. Use the same password later in A2.

node --version
npm install -g @agegr/pi-web@0.13.0
command -v pi-web
pi-web version
(
  read -r -s -p 'Pi Web password: ' PI_WEB_PASSWORD
  printf '\n'
  test -n "$PI_WEB_PASSWORD" || { printf 'Empty password; not starting.\n'; exit 1; }
  export PI_WEB_PASSWORD
  exec pi-web --hostname 127.0.0.1 --port 30141 --no-open
)

The version appears only in the install command, so the guide can be reproduced; later launches run the installed pi-web and never upgrade on their own. command -v pi-web should point into npm's global install directory, not the .npm/_npx/ temporary cache. If npm reports install scripts that are not yet approved, don't approve them in bulk. If a Pi Web is already using port 30141, don't start a second one. Run it as the same system user and filesystem environment as your existing Pi, or you'll get an empty set of sessions.

In the example Pi Web runs in WSL, and Windows also needs to reach it. Open the address above in a Windows browser, or run this read-only check in PowerShell:

(Invoke-WebRequest -UseBasicParsing -Uri 'http://127.0.0.1:30141/' -TimeoutSec 10).StatusCode

You should see 200. The example machine uses WSL2 mirrored networking and this passed; trust your own result. If it fails, check the WSL service and local access first. Don't switch off the firewall or change the listen address to 0.0.0.0.

When running natively on macOS or Linux, put the connection tool on the same machine as the app.

A: connect the phone and the computer privately

This route does three things: let the devices see each other → give the local page an HTTPS address → open it on the phone. Starting on boot can wait. Before handling private media, also check the data flows and permission boundaries in A4.

Route A diagram: the phone reaches your own computer over Tailscale's encrypted link; Serve unwraps HTTPS on the computer and hands it to the local Pi Web. Not a screenshot.

A1 · Both devices in the same list

Install the Windows and Android clients from the Tailscale download page and sign in with the same account. After you click sign in, the browser can take several seconds, sometimes more than ten, to show the login page; wait instead of clicking again. On the phone, turn off any other VPN app before switching Tailscale on. Turn on two-factor authentication for the account. Leave Exit Node off this time (that feature sends the rest of the phone's internet traffic out through one device).

Prefer to watch first? Tailscale's own get-started video (about 10 minutes) shows the sign-in. Near the end it also sets up Tailscale SSH and an exit node, which this guide doesn't need.

Open the device list and confirm both the phone and the computer are online. Right after connecting, the phone may reach the computer through a relay; if it works, leave it for now. Try this in your own new network and don't share the computer with anyone. If you're joining an existing team network, check that its access rules only let your own devices reach this computer's HTTPS port.

You can stop here for today. Having both devices online is a complete small step.

A2 · Give the computer an HTTPS address

Use these three steps for the initial setup. Serve runs on Windows; Pi Web stays in WSL. Set and verify the Pi Web password before opening the remote entry point. For later restarts, use the start script below.

A2.1 · Windows: get the full device name

On the DNS page of the Tailscale admin console, turn on MagicDNS (device name resolution) and HTTPS Certificates. In the example setup MagicDNS was already on but HTTPS Certificates had to be switched on by hand; doing it in the console is more reliable than waiting for the command line to request it. Once enabled, the device's full domain name is written into public certificate records anyone can search. People can find the name but can't connect; rename any device whose name includes a real name or company first.

In Windows PowerShell, read the device's full domain name:

$ts = tailscale status --json | ConvertFrom-Json
$ts.Self.DNSName.TrimEnd('.')

Note the output without the trailing dot and without https://. If the command isn't found, reopen PowerShell after installing, or call tailscale.exe from the install folder.

A2.2 · WSL: save a start script, restart with a password and check

In the WSL Bash where Pi Web runs, first save the full device name from A2.1. If the file already exists, the command stops instead of overwriting it:

(
  set -eu
  umask 077
  file="$HOME/.config/pi-web/allowed-hosts"
  test ! -e "$file" || {
    printf 'File exists; not overwritten. Check it first.\n'
    exit 1
  }
  read -r -p 'Paste the full device name (no https://): ' host
  [[ "$host" == *.ts.net && "$host" != *[[:space:]/:]* ]] || {
    printf 'Unexpected device name; nothing saved.\n'
    exit 1
  }
  mkdir -p "$HOME/.config/pi-web"
  (set -C; printf '%s\n' "$host" > "$file")
  printf 'Device name saved.\n'
)

Then create the start script. It reads that name and asks for the password at each launch, so the password is never written to disk. It calls the installed pi-web, so the script holds no version:

(
  set -eu
  umask 077
  script="$HOME/.local/bin/pi-web-start"
  test ! -e "$script" || {
    printf 'Start script exists; not overwritten.\n'
    exit 1
  }
  mkdir -p "$HOME/.local/bin"
  set -C
  cat > "$script" <<'EOF'
#!/usr/bin/env bash
set -eu
PI_WEB_ALLOWED_HOSTS=$(cat "$HOME/.config/pi-web/allowed-hosts")
test -n "$PI_WEB_ALLOWED_HOSTS" || {
  printf 'Empty device name; not starting.\n'
  exit 1
}
export PI_WEB_ALLOWED_HOSTS
read -r -s -p 'Pi Web password: ' PI_WEB_PASSWORD
printf '\n'
test -n "$PI_WEB_PASSWORD" || {
  printf 'Empty password; not starting.\n'
  exit 1
}
export PI_WEB_PASSWORD
exec pi-web --hostname 127.0.0.1 --port 30141 --no-open
EOF
  chmod u+x "$script"
  bash -n "$script"
  printf 'Start script ready; not started yet.\n'
)

Next, stop the old instance and start again with the script. Stopping interrupts tasks and web terminals running in the old instance; saved sessions are kept. Wait for replies to finish first. If you're reading this guide or talking to an agent inside Pi Web, note this command down first:

pi-web stop --port 30141 &&
  "$HOME/.local/bin/pi-web-start"

If the first half fails, nothing starts. If Pi Web isn't running yet after a fresh install, run only the second line. At Pi Web password:, enter the password from your password manager; nothing is shown as you type. Keep this terminal window open: closing it or pressing Ctrl+C stops Pi Web. If pi-web stop finds no instance, check with pi-web status; avoid broad kill-process commands.

If the computer's browser shows no login page, the password may still be on: a sign-in made earlier with the same password stays valid for 30 days. In the example setup, the computer's browser went straight to the sessions, both checks below passed, and a private window on the phone showed the login page first. If the browser pops up its own username-and-password box, cancel it, close old tabs and reopen the page, then enter only the password on Pi Web's own login page.

Check the running service, not whether a variable is still set in your shell. In a new WSL terminal, run this read-only check. It carries no browser sign-in and makes no model call:

curl -q --noproxy '*' --fail --silent --show-error --max-time 10 \
  http://127.0.0.1:30141/api/web-auth

The expected response is:

{"enabled":true,"authenticated":false}

enabled: true means the running service requires a password. authenticated: false means this check is not signed in, as expected. Also confirm an unsigned request cannot read sessions:

curl -q --noproxy '*' --silent --show-error --max-time 10 \
  --output /dev/null --write-out 'HTTP %{http_code}\n' \
  http://127.0.0.1:30141/api/sessions

Expect HTTP 401 (authentication required), not HTTP 200. If enabled is false, the session API accepts the unsigned request, or either check fails, don't enable Serve yet; press Ctrl+C in the start window, then check the device-name file and the script. If a remote entry point already exists, turn off this guide's Serve route using the shutdown instructions at the end before fixing the password. A Ready message or a page that loads is not a substitute for these checks.

A2.3 · Windows: enable and check Serve

Back in Windows PowerShell, start with read-only checks:

tailscale serve status
tailscale funnel status

A route marked (tailnet only) is available only to devices in the tailnet permitted by its access control policy. Even if tailscale funnel status lists the same private route, that does not mean it is public. / proxy http://127.0.0.1:30141 means the root path forwards to the local Pi Web.

If a route says (Funnel on) or is explicitly marked public, stop configuring and investigate. Don't enable Funnel just to test it. The official documentation says the same port cannot serve private Serve and public Funnel at the same time; read the route's status marker, not just the command's name.

If this guide's route already points to the right target and says tailnet only, checking it is enough: there is no need for funnel off, a global reset, or recreating the route. If another Serve service exists, stop here so you don't take its port or overwrite its route. Only enable a new route if none is configured and there is no conflict:

tailscale serve --bg --https=443 http://127.0.0.1:30141
tailscale serve status
tailscale funnel status

Complete the HTTPS authorization if prompted. If it reports error enabling https feature … context deadline exceeded, the command line timed out reaching Tailscale's servers and a retry usually fails the same way; switch on HTTPS Certificates on the console's DNS page, wait a minute or two, and run the command again. Note the full https://…ts.net address it prints and check that the route still says tailnet only. This is serve, for permitted devices in the tailnet; not the internet-facing funnel. There are no certificate files to manage.

Bounded security checks on November 1, 2026 (Beijing time) examined the instance running then, not every possible deployment. A4 explains the authentication tests and code-review scope.

CheckRecorded result
Pi Web version0.13.0
WSL listener127.0.0.1:30141
Tailscale Servetailnet only, forwarding to local port 30141
Public Funnel exposureNot enabled in the checked status output
Pi Web password endpointenabled: true, authenticated: false
Unsigned requestsTested requests to session APIs and synthetic file paths were blocked; 31 non-destructive HTTP checks in total
HTTPS entry pointTwo requests from Windows through the computer's own Serve, with normal certificate verification: auth status worked; sessions returned 401
Not yet verifiedComplete access policy, remote-device packet capture, authenticated media operations and caching; this was not a full penetration test

A3 · Turn off Wi-Fi on the phone and open that address

On mobile data, with Tailscale on and any other VPN app off, open the HTTPS address Serve printed in Chrome. Wi-Fi is off only for this check: with the phone and the computer on the same Wi-Fi, a working connection doesn't prove it will work away from home. Once it passes, use it with Wi-Fi on as usual. It counts as working from another network once you see the Pi Web login, enter the password and see your own sessions. If the browser reports a certificate error, stop and check the address; don't click through.

The first time, just read sessions. Once you're fine paying for a model call, send "Reply only that the connection works; use no tools" and watch whether the reply streams in. Then turn Tailscale off on the phone and retry in a new private window: it should fail to connect. That proves the entry point is private, not a cached page.

In Chrome's menu, choose "Install app" or "Add to Home screen". This PWA (Progressive Web App, an installable web app; installation) is only a handier entry point: the computer still has to be on, and the phone still needs a connection with Tailscale on.

Some Android phones need Chrome's "create home screen shortcuts" permission switched on in system settings first, or adding fails. If it says the app installed but you can't see it on the home screen, look for "Pi Web" in the app drawer or system search. Phones differ here; a shortcut that opens the page is enough.

Once it connects, check A4 if you handle private media. You do not need B.

A4 · Media and third-party privacy boundaries

Previewing a file, uploading it to the computer, and sending its contents to a model are different operations with different destinations. The diagram follows the default code paths checked in Pi Web 0.13.0, not captured network traffic. Extensions, tools and the actual model configuration may add outbound connections.

Route A media data flow: the remote browser connects over an encrypted network to local Serve, which terminates HTTPS before forwarding to Pi Web in WSL. Chat attachments or tool results that enter the model context may travel separately to the actual model endpoint. Accounts, certificates, updates, push and backups have their own privacy boundaries.

ActionWhere the data goesAutomatically sent to a model?
Open an image or play a video in the file panelLocal file → Pi Web → remote browser; video may be read in rangesNot in the preview paths checked
Upload through the file panelSelected browser file → selected local directory, leaving a disk copyNot by the upload itself
Attach an image in chat and send itImage data with the message → agent → actual model endpointYes; a normal model request uses that input
Attach a non-image file in chat, including videoUploaded to the session working directory, then inserted as a file referenceNot by the upload itself; later reading or processing is separate
Ask the agent to read an image or extract video framesFile or processed result → tool output → possibly model contextMay be sent with a request once it enters the context

The green live indicator in the image preview means file-change watching is connected: editing the local file refreshes the browser preview. It is not a live camera feed or an indication that the image is being sent to a model. A browser file picker uploads the selected files; it does not thereby let the server browse the remote device's entire media library. Check operating-system photo permissions separately.

The ordinary image and video paths do not establish that every preview stays offline. Markdown images may retain remote URLs, causing the browser to contact a third party and expose its outbound IP, request time and URL parameters. HTML preview's sandbox="allow-scripts" restricts same-origin privileges, but is not a network firewall: permitted scripts can access the preview document itself, and remote resources in that document may trigger outbound requests. The review did not demonstrate a same-origin escape or test actual data exfiltration. In sensitive workspaces, avoid untrusted active HTML previews and do not load remote Markdown images by default.

Who can see what at each stage?
Participant or boundaryInformation it can accessDo not assume
Remote browser, operating system and extensions with sufficient permissionsDisplayed plaintext, downloads, screenshots, caches and sign-in statePrivate browsing or signing out erases every copy
Carrier, local network and Tailscale relaysAddresses, timing and traffic volume visible at their position; relays forward ciphertextHidden content means no metadata exists
Tailscale coordination service and sign-in providerAccount, device, sign-in or connection information each handlesEncryption removes trust in account and node authorization
Certificate authority and public certificate logsServe's full device hostname, not media payloadsA private URL's hostname is also secret
Your Windows, WSL and Pi Web processesDecrypted requests, readable files, sessions and runtime credentialsLocal HTTP is public-internet plaintext, or local processes are necessarily trustworthy
Actual cloud-model endpoint, API gateway and upstream providersText, images, tool results and other inputs they receiveHTTPS hides inputs from the recipient, or a displayed model name proves who receives them
Optional push, update checks and telemetryPush subscription and delivery metadata; other information depends on actual request fieldsEvery external connection uploads media, or the installation makes no external connections
Cloud photo services, file sync and backupsCopies and metadata involved in configured sync, downloads or backupsTailscale encryption also protects copies held by a separate service

The DERP documentation says relays lack device private keys and cannot decrypt the traffic they forward. The Serve documentation describes HTTPS terminating in the local Tailscale process by default. Neither guarantees bug-free third-party software, uncompromised accounts or safe endpoints receiving the media.

The coordination service also distributes node public keys. Tailnet Lock uses trusted-node signatures to approve new nodes, reducing trust in that distribution layer. It requires recovery material and a device-replacement plan. It was not enabled or verified in this review; do not experiment with it on your only remote entry point.

Web Push encrypts its payloads, so passing through Apple, Google or another push service does not by itself mean that service can read notification text. After browser decryption, a title may still appear on the lock screen. The completion-notification payload checked here contained no media files, but sensitive titles should still be avoided. Pi Web checks for updates, and the bundled Pi contains telemetry-related code. The entire implementation and all extensions were not audited, so this is not a zero-telemetry claim.

What copies remain in files, chats and browsers?

Uploading normally copies a file; it does not delete the original from the source device. File-panel uploads go to the selected directory; non-image chat uploads go to the session working directory. Do not assume uploads strip EXIF (photo metadata that may include location and capture time).

In the unsent-draft path checked here, chat images temporarily stay in browser memory. After sending, messages can store image data in JSONL session files under the default ~/.pi/agent/sessions/ directory. Deleting the original image does not remove its chat copy. Images may be resized before sending, so that copy is not necessarily byte-for-byte identical to the original.

Pi Web's Service Worker, the browser background script used for features such as the offline entry point, excludes /api/ from its static cache. Media responses nevertheless use Cache-Control: no-cache, not no-store. The former requires revalidation before reuse; it does not prohibit storage. Downloads, screenshots, operating-system backups and cloud sync are separate. Signing out or removing a network device does not remotely erase downloaded content.

What should be hardened first?

Prioritize the impact of a failure, not the ease of a setting:

  1. Limit model inputs. For images or videos not approved for cloud processing, use ordinary media preview only: do not attach them to chat or ask tools to read them. This is an operating rule, not technical isolation. Before processing, identify the actual endpoint, intermediaries, upstream providers, retention and training policies; the model menu's label is insufficient. If content must never leave your devices, separately verify a local model and outbound-network restrictions rather than relying on a cloud model.
  2. Limit agent permissions. Expose only necessary working files, preferably copies; do not mount an entire personal media library. A working directory is not a sandbox, and accessible Windows drives mounted in WSL may still be readable. Separate users need effective file permissions. Stronger isolation must cover the whole Pi process, its extensions and subprocesses, with outbound restrictions; isolating one tool does not isolate the application. For private media browsing as the main goal, a safer design separates it from the tool-enabled agent: use a restricted read-only media service and give Pi only approved processing copies. That design was not implemented here.
  3. Protect the entry point. Keep the loopback listener, private Serve and a separate long random password; do not enable Funnel. Check the actual tailnet access policy rather than assuming only your devices can connect. Enable multi-factor authentication and remove old devices promptly. PI_WEB_ALLOWED_HOSTS validates request hostnames; it is not a device-identity allow list.
  4. Protect sign-in and endpoints. Use the correct HTTPS address and do not ignore certificate errors or disable origin checks to accommodate a proxy. Sign-in credentials last 30 days; closing a tab does not revoke them. The checked sign-out code clears the current browser's cookie, not every copied credential. If a device is lost, remove it from the network, then restart Pi Web with a new password to invalidate old credentials. Revoke existing push subscriptions separately; do not assume a password change removes them. Change the password locally or through a reliable backup entry point to avoid locking yourself out.
  5. Limit copies and side channels. Lock remote devices, hide sensitive notification previews when needed, and check cloud drives, photo sync, backups and browser extensions. Keep real names and company names out of device hostnames; renaming later does not erase public certificate records. Review upgrades and recheck the entry point afterward rather than staying on an old version solely because an earlier test passed.

The review did not change the running instance's access policy, execution isolation or password. File-panel path checks are not the agent's permission boundary either: mode 600 cannot stop an agent running as the same operating-system user from reading that user's secrets.

What did the tests establish, and what remains untested?

The November 1, 2026 dynamic checks were limited to an owner-controlled instance: 31 serial, unsigned GET, HEAD and OPTIONS requests covering representative APIs, abnormal Host and Origin values, forwarding headers and a few encoded paths. No unauthenticated bypass was observed in those requests. Two additional read-only requests from Windows through the computer's own Serve HTTPS entry point used normal certificate verification and confirmed auth status and rejection of unsigned session access. These were not cross-network phone tests.

Code review covered key authentication, media preview and upload, chat submission, session persistence and browser-cache paths in the installed package. The reviewer did not sign in to the live instance or inspect cookies issued by its current HTTPS entry point. Tested 401 responses had no-store; that does not establish that all authenticated sensitive responses prohibit caching.

A temporary isolated copy of the same release received 11 synthetic requests. Forged cookies and correctly signed but expired cookies were rejected. A cookie copied before sign-out could still access an authenticated API afterward. Ordinary text read and metadata responses had no explicit Cache-Control header. The test login over HTTP issued a cookie with HttpOnly, SameSite=Lax and a 30-day lifetime, without Secure; that does not establish the cookie attributes at the HTTPS entry point. Testing stopped when reading a file-watch stream timed out, so subsequent planned checks did not run. The temporary processes were cleaned up; no real passwords, sessions or media were used.

There was no password brute force, model call, private-media upload, terminal launch, live-configuration change or load test. Complete access policies, remote-browser caches, authenticated uploads and path authorization, all dependency vulnerabilities, and actual third-party retention were not verified. WSL lacked raw-socket permissions, so no packet capture was performed. Windows capture would require separately authorized administrator access; there is no remote packet-level evidence. Even a capture showing no plaintext would not prove that every future operation stays local or that recipients retain nothing.

B: when the phone's VPN can't be turned off, use a fixed URL

When the phone must keep another VPN app on, use a fixed Cloudflare tunnel with a sign-in door in front (Tunnel + Access). It doesn't take the phone's VPN slot, but the page content is unwrapped at Cloudflare; if you require HTTPS for the remote entry point to terminate on your own computer, this is not an equivalent.

Three things here too: limit who can get in → connect the local service → check it from the phone.

Route B diagram: the phone reaches Cloudflare over HTTPS and Access checks identity first; after Cloudflare unwraps it, traffic goes through an encrypted tunnel to the computer, where cloudflared checks the Access token again. Not a screenshot.

B1 · First, a door that only lets you in

You need a domain managed by Cloudflare. Below, pi.example.com stands for your subdomain; use your own, pick a subdomain with no DNS record yet, and leave the root domain and any existing site's records alone.

If you have several Cloudflare accounts, pick the one that holds this domain in the browser, and confirm the zone, tunnel and Access all belong to it. An existing cert.pem, Wrangler login or environment variable on Windows or WSL doesn't prove which account you're in.

In that account, create or open Zero Trust, choose a plan and confirm the charge; for one person, start by checking Free and don't switch on paid add-ons along the way. Turn on two-factor authentication for the admin account.

Under Access → Applications, create a self-hosted web application covering all of pi.example.com, not just the home page. The Allow policy lists your own email exactly under Emails; everyone else stays denied. Don't choose Everyone, don't treat "log in with an email code" as the allow list itself, and don't add a Bypass. Cloudflare lists "include everyone" and "include all valid emails" as common misconfigurations that let anyone in (Access policies).

For login, use your own identity provider or email codes; turn on multi-factor authentication where available for a sensitive entry point like this. A 24-hour session is a reasonable start; adjust later. The phone doesn't need WARP.

Save Access before creating the public route. That order avoids a window where the tunnel works but the door doesn't exist yet.

B2 · A separate tunnel to the computer, leaving old credentials alone

In the WSL where Pi Web runs, install cloudflared following Cloudflare's download instructions. Here it sits in the same environment as Pi Web, so nothing depends on Windows-to-WSL forwarding.

Set Pi Web's PI_WEB_ALLOWED_HOSTS to pi.example.com and give it a non-empty PI_WEB_PASSWORD, still listening on 127.0.0.1:30141. The silent password prompt from A2 works here; wait for tasks to finish, stop the old instance, and restart it as the same user with the version you've confirmed. Don't reuse a model API key as the site password.

In the confirmed Cloudflare account, create a dashboard-managed tunnel, named for example pi-web. Running it only needs that tunnel's own token (its run credential). You don't need cloudflared tunnel login, and you don't replace an old ~/.cloudflared/cert.pem.

Check it as a foreground process first; don't copy a service install that could overwrite an existing service. This saves a separate credential in WSL Bash, and stops if the folder already exists rather than overwriting it:

(
  set -eu
  umask 077
  mkdir -p "$HOME/.config"
  mkdir "$HOME/.config/pi-web-tunnel"
  read -r -s -p 'Paste this tunnel token: ' TOKEN
  printf '\n'
  test -n "$TOKEN" || { printf 'Empty token; stopped.\n'; exit 1; }
  printf '%s' "$TOKEN" > "$HOME/.config/pi-web-tunnel/token"
  unset TOKEN
)

Don't paste the token while recording the screen; a silent prompt doesn't stop the recording from catching the dashboard, clipboard history or password manager.

A separate config path keeps an old default config from being read by mistake. The first line creates an empty config only on the first run, so repeating it changes nothing, and the token never appears in the command arguments:

test -e "$HOME/.config/pi-web-tunnel/empty.yml" || printf '{}\n' > "$HOME/.config/pi-web-tunnel/empty.yml"
env -u TUNNEL_TOKEN -u TUNNEL_ORIGIN_CERT \
  cloudflared tunnel \
  --config "$HOME/.config/pi-web-tunnel/empty.yml" \
  run --token-file "$HOME/.config/pi-web-tunnel/token"

--token-file needs cloudflared 2025.4.0 or newer. Check other leftover TUNNEL_* settings in this process's environment without printing the full environment, which may hold secrets. Confirm in the dashboard that the new tunnel is healthy.

Add a Published application route to this tunnel:

SettingExample here
Hostnamepi.example.com
Service URLhttp://127.0.0.1:30141
Protect with AccessOn, choosing the Access application and its Audience from B1

With Protect with Access correctly enabled on this route and the expected Audience configured, cloudflared checks the credential issued by Access and rejects requests without a valid one. This does not replace the Access policy that limits access to you, nor does it protect every other route pointing at the same tunnel. Verify other entry points separately (validate the Access token).

Keep the public Host; don't force the HTTP Host Header to localhost. Pi Web checks that the address on a request is one it accepts, and refuses actions such as sending a message when it isn't. The http:// in the table is only the last hop inside your computer; phone to Cloudflare and Cloudflare to the computer are both encrypted.

Don't use a temporary Quick Tunnel (a random trycloudflare.com address). Cloudflare's documentation says it doesn't support SSE (Server-Sent Events, the event stream Pi Web uses for streaming replies and the terminal). You also don't need a Worker, Nginx or router port forwarding.

The token is this tunnel's key: whoever has it can run the tunnel (tunnel tokens). A separate folder keeps it apart from other accounts, and 0600 keeps other system users on the computer from reading it; an agent running as the same user can still read it. Before running this long term, consider a separate service identity and credential isolation, and check permissions and existing services before setting up autostart.

B3 · Check with one refusal and one success

In a private window, open https://pi.example.com/; you should get the Access login. Requesting /api/sessions directly while signed out must not return session data either, and identities outside the allow list must be refused. An account without a password isn't safe, so don't skip the API check just because the home page shows a login.

After you pass Access, Pi Web still asks for its password. Read sessions first, then run one small, non-sensitive reply test as in A3.

On the phone, test with the other VPN app off and on, then switch between Wi-Fi and mobile data. The URL is the same in each state, but the network path differs. If reaching Cloudflare directly is slow, note which network it was, and don't turn "works with the VPN app on" into "always stable".

After installing to the home screen from Chrome, test signing in again and reopening after the screen locks. When the Access session expires, open the home page and sign in again; don't open up /api/* to fix a login problem. Once it works the first time, stop; notifications and autostart can wait.

Every time the computer restarts

Once the first setup works, most of it comes back by itself after a restart or a shutdown; only Pi Web needs starting by hand. This section follows Route A. On the example setup, the A2.2 script has been used for one manual switch and a private window on the phone confirmed the login; nobody has yet walked through a full recovery after a Windows restart.

After a restartComes back by itself?
Tailscale on WindowsYes, but by default only once you sign in to Windows (unattended mode)
Serve's HTTPS addressYes. Serve started with --bg resumes after a reboot (Serve docs)
WSL and Pi WebNo. Start Pi Web in WSL by hand each time
Pi Web sign-in on the phoneUsually remains valid for 30 days from issuance, if the browser keeps the credential and Pi Web starts with the same password

The last row was rechecked in Pi Web 0.13.0's authentication code: the credential is signed with the Pi Web password and expires 30 days after issuance. A restart does not reset that clock. Enter the same password each time; changing it requires every signed-in device to sign in again.

After each restart

  1. Sign in to Windows. Nothing to do in PowerShell; to check, tailscale serve status should still show the https://…ts.net address pointing at http://127.0.0.1:30141.

  2. Open a WSL terminal, run the start script from A2.2 and enter the Pi Web password:

    pi-web-start

    If the command isn't found, use the full path ~/.local/bin/pi-web-start. Open http://127.0.0.1:30141 in the computer's browser and use A2.2's two read-only checks to confirm enabled: true and HTTP 401 before connecting from the phone. Minimize the terminal window, but don't close it: closing it or pressing Ctrl+C stops Pi Web.

  3. On the phone, open Tailscale and check it's connected, then tap the Pi Web icon.

Nothing special is needed before shutting down. If Pi Web is in the middle of a reply, let it finish first: a restart cuts off the reply in progress, though the session history stays.

Upgrade Pi Web separately, not as part of each restart. Run pi-web update --check to see whether a newer version exists. To upgrade, wait for tasks to finish, run pi-web stop --port 30141 and pi-web update, confirm with pi-web version, then run pi-web-start and the A2.2 checks. The upgrade path has not been tested for this guide.

Route B needs different Pi Web startup settings, not just an extra tunnel process. A's start script reads the *.ts.net hostname saved in A2; do not reuse it unchanged for B. After signing in to Windows, open WSL and start Pi Web with B's allowed hostname instead. Replace pi.example.com with the exact hostname you configured in B2, and enter the same Pi Web password:

(
  export PI_WEB_ALLOWED_HOSTS=pi.example.com
  read -r -s -p 'Pi Web password: ' PI_WEB_PASSWORD
  printf '\n'
  test -n "$PI_WEB_PASSWORD" || { printf 'Empty password; not starting.\n'; exit 1; }
  export PI_WEB_PASSWORD
  exec pi-web --hostname 127.0.0.1 --port 30141 --no-open
)

Keep the window open and run A2.2's two unsigned local checks. In a second WSL terminal, rerun the cloudflared tunnel … run --token-file … command from B2, then repeat B3's Access and Pi Web sign-in checks. Both are foreground processes: closing either window stops that part of the connection.

If the computer restarts for a system update while you're away, Pi Web won't come back until you're at the computer again. Before a long trip, set active hours in Windows Update or pause updates. Ticking Run unattended under Preferences in the Tailscale tray menu keeps Tailscale online when nobody is signed in to Windows, but it only covers Tailscale; Pi Web still has to be started by hand. Starting Pi Web fully automatically at boot would mean storing the password on disk, where agents running as the same user can read it; this guide doesn't go there.

Things you'll need to sign in to again from time to time
WhatHow oftenWhen it lapsesWhat to do
Tailscale device key180 days by defaultThat device drops offSign in to Tailscale again on that device
Pi Web sign-in30 days, or when you change the passwordBack to the login pageEnter the Pi Web password
Model account (subscription login or API key)Depends on the providerPi Web replies fail with an auth errorOn the computer, open Pi Web's Models panel and sign in again or re-enter the key
HTTPS certificateLet's Encrypt certificates expire after 90 daysThe phone shows a certificate errorSee below
B: Access sign-inThe session length you setYou land on the Access login pageSign in again

When the computer's key expires, you can't fix it from outside: the computer is offline and the phone can't reach it. On the Machines page of the Tailscale admin console, the menu on the computer's row has Disable Key Expiry, which stops it expiring (key expiry). The trade-off is that this computer's key no longer lapses on its own, so the Tailscale account's own security matters more. Otherwise, sign in again at the computer before the key expires. Tailscale warns that renewing with tailscale up --force-reauth can drop the connection briefly, so don't run it over a remote session.

Model credentials are shared with Pi in the terminal and live under ~/.pi/agent on the computer by default (Pi Web README); signing in again from either works.

Serve provisions the certificate itself, so there are no certificate files to manage; the official docs don't say how Serve renews it, and the example setup hasn't run for 90 days yet. If the phone shows a certificate error, don't click through; run tailscale serve status on the computer and confirm the address and service are still there.

Lost phone, forgotten password, reinstalled computer: where to start again
  • Forgot the Pi Web password: Pi Web doesn't store it. Run pi-web stop --port 30141, then pi-web-start with a new one; every device signs in again with the new password.
  • Lost the phone: first remove it on the Machines page of the Tailscale admin console, so it can no longer join your network; then restart Pi Web with a new password. The old phone's sign-in stops working because its token was signed with the old password. If web push was enabled, revoke the old subscription separately; changing the password must not be assumed to stop notifications. On Route B, also revoke that user's sessions in Cloudflare Zero Trust.
  • New phone: install Tailscale, sign in to the same account, open the computer's ts.net address and sign in to Pi Web, then remove the old phone in the console.
  • Reinstalled the computer, or Tailscale got signed out: after signing in again, the computer may count as a new device with a different name, which changes the ts.net address. Put the new address in ~/.config/pi-web/allowed-hosts, rerun the two Serve commands from A2, and remove the old device in the console.
  • Lost ~/.pi/agent: sign in to the model again or re-enter the key. Session files live in that directory too (Pi Web README), which makes it worth backing up; the backup holds credentials, so keep it like a password.

Once it connects, deal with these

Doesn't a private network make the connection immune to network conditions?

No. Tailscale tries to connect the two devices directly; when the network prevents that, traffic goes through an encrypted relay (connection types). The relay can't open the content, but it can be slower. Direct connections also depend on phone signal, the carrier's route and your home upload speed.

With the phone online, run tailscale status on the computer, or tailscale ping the phone's device name. direct means a direct connection; relay or peer-relay means a relay. Starting on a relay and moving to direct later is normal. Look at the actual path before switching off the firewall, opening router ports or buying a server.

From mainland China, relayed connections are often slower: as of October 2026, Tailscale's default relays include none in mainland China; the nearest are Hong Kong, Tokyo and Singapore (relays). In tailscale status, a relay is followed by its region code, such as hkg for Hong Kong or tok for Tokyo. If you keep landing on a slow relay, there are two directions, neither tested for this guide:

  • Tailscale's Peer Relay: a well-connected, always-on device in your own tailnet acts as the relay. It can't be a phone, needs Tailscale 1.86 or later, and needs a UDP port the other devices can reach. Connections stay inside the same account and access rules, so this guide's security statements still hold.
  • A mesh tool that can use shared nodes inside China, such as the open-source EasyTier. The costs are real: without root, Android runs it through the system VPN interface, so it takes the VPN slot too; there's no ready-made HTTPS address, Pi Web has to listen on another address, and PWA install and push notifications stop working; any device that knows the network name and secret can join. On someone else's shared node, turn on its secure mode and pin the node's public key; otherwise its docs don't promise the relay can't read your traffic.

Switching off the phone's VPN app for a while is not the same as the phone having no internet. In the first case A may still connect; in the second, no remote method works. Cloudflare and remote desktop apps are affected by the network too.

With several sessions open, sending a message just spins?

Usually that's the browser's connection limit, not a slow network. Over a plain http:// address a browser opens at most six connections to one origin, shared by all its tabs, and Pi Web holds one long-lived stream for every open chat, terminal and file preview. With enough active pages, requests like sending a message or opening Settings wait inside the browser until a stream closes (Pi Web: Serving over HTTP/2). The same page says Pi Web lets go of a hidden tab's idle streams after 30 seconds, so most people never reach the limit.

Over HTTPS the browser switches to HTTP/2, where one connection carries every stream and the six-connection ceiling goes away. Route A's ts.net address is already HTTPS, and it's what the phone uses. If you often keep many active pages open on the computer too, point the computer's browser at the same ts.net address; Pi Web needs no change. In the example setup, after that switch, requests stopped queueing with several windows active at once.

Check in the browser: in the developer tools' Network panel, turn on the Protocol column; h2 means HTTP/2. Don't conclude from a command-line tool alone: in the example setup, curl on Windows once reported HTTP/1.1, and a request that asked for HTTP/2 got HTTP/2 from the same Serve address.

The cost is that the computer's own entry now depends on Tailscale running, and with a system proxy on you need *.ts.net in its bypass list (see the troubleshooting table below). Compared with the plain address there is one more hop, the local Serve, which decrypts HTTPS before handing the request to Pi Web. Requests don't detour through Tailscale's servers: in the example setup the ts.net name resolves, on the computer, to its own Tailscale address. No valid speed comparison was made here, so this guide doesn't call it faster or slower.

If you'd rather the local entry not depend on Tailscale, Pi Web's page offers another way: Caddy on the computer issues a localhost certificate and serves HTTPS. That means adding Caddy's own root certificate to the system trust store; if its private key leaks, it can be used to impersonate any site on that computer, and you have to remove the trust when you stop using it. The example setup is only on a time-limited trial of this, so it isn't covered further.

What happens when the computer sleeps, the phone locks, or a task is running?

The computer, WSL and Pi Web all have to keep running; a locked screen is not sleep. Check the plugged-in sleep settings before relying on this, though the display doesn't need to stay on. What comes back by itself after a restart, and what you start by hand, is under "Every time the computer restarts" above.

An agent task Pi Web has already accepted doesn't need the phone's screen on, and state is restored when you return; that doesn't mean a task survives a Pi Web process restart intact.

The web terminal has its own lifetime: in the version checked here, it is reclaimed about 120 seconds after the last client disconnects. For long terminal work use tmux (a tool that keeps terminal sessions alive), rather than keeping the phone from ever locking.

Which route fits on cost and privacy?

Tailscale's Personal plan is free and, by its own terms, for non-commercial use only (pricing); Serve provides the device domain, so you don't need to buy one; for work use, check the actual plan terms. On Cloudflare, a personal setup can start on Free, and with an existing domain you don't need a server; domain renewal and model costs still apply. A free plan is neither unlimited nor an availability promise.

In A, page content is unwrapped on your own computer; Tailscale still knows the account, devices and connection records. In B, it's unwrapped at Cloudflare first; the app password and Access decide who gets in, but they don't stop Cloudflare from seeing what passes through it. If company or client data needs authorization, go through your organization first; "only I use it" is not a compliance conclusion.

Remote access to Pi Web also means remote control of the local agent. The Pi Web README explains that it shares model credentials, configuration and sessions with terminal Pi, and can work with project files and run agents. Even if an API key is not displayed on the page, someone with sufficient control may still reach sensitive credentials through files or commands. A private network does not isolate the agent's execution environment.

Use a separate API key for this purpose, grant only the API permissions needed, and set project spending limits. Check whether a limit actually stops spending or merely sends an alert; an alert does not prevent further charges. Keep the Pi Web password, Tailscale access controls and local file permissions in effect, and keep keys out of chat histories, Git repositories and public logs. An agent running as the same operating-system user may still read that user's credentials; file permissions do not isolate operations under the same user.

Notifications can wait. Pi Web's completion push may show the session title on the lock screen, so keep client names and sensitive details out of titles. With cloud models, the provider's data policy is a separate question; a different way in doesn't change what input the model receives.

When it won't open, check in this order; turning it off is simple too

Check the computer's local address first, then whether the connection tool is online, then the phone's network and browser login. Don't change three layers at once.

SymptomDo this first
The local address on the computer won't openCheck the original Pi Web process; leave the tunnel alone
Nothing happens after clicking sign in on WindowsWait a dozen seconds for the browser; if still nothing, click once more
A drops after turning on another VPN appTurn that app off and reconnect Tailscale
A username-and-password box pops up after restarting Pi WebCancel it, close old tabs, reopen the Pi Web address and enter only the password
Serve reports error enabling https featureSwitch on HTTPS Certificates on the console's DNS page, wait, run Serve again
Opening the ts.net address on the computer says the connection was resetWith a system proxy on, add *.ts.net to its bypass list; the phone is not affected
A's devices are online but HTTPS is refusedCheck the full device name, Serve status, access rules and Pi Web's allowed hosts
B returns 403Tell an Access denial from Pi Web's Untrusted request; check the allow list and Host
B returns 502 / tunnel offlineFrom where cloudflared runs, open the local service; check the tunnel's outbound network
With several sessions open, sending a message or opening Settings keeps spinningLook at the Network panel's Protocol column; if it says http/1.1, close pages you don't need or use the HTTPS address (see "With several sessions open" above)
A reply appears all at once, or long operations time outCheck whether SSE is buffered; test long POSTs such as manual compaction on their own, and don't resend actions with side effects
An HTML error appears suddenly after signing inGo back to the home page and sign in to Access again; don't remove API protection

To turn A off, check tailscale serve status first and confirm 443 is this guide's service, then turn off just that one:

tailscale serve --https=443 off

Don't use a global reset that wipes other routes. To turn B off, press Ctrl+C in your foreground cloudflared window, then remove the subdomain's tunnel route; keep Access until the public route is gone, so the door isn't removed first. If the token leaks, rotate it and disconnect old connections; deleting the local file isn't enough.

The bar for the first round is small: on mobile data the phone can sign in and read sessions, and people who shouldn't get in can't. Once that works, decide whether you need autostart, notifications and a backup remote desktop.

Writing note: gpt-6-astra: draft; Claude Opus 5.5: restarts, HTTP/2; gpt-6.1-sol: security, diagrams, English.

Comments →

CC BY-NC-SA 4.0

Comments

Comments are powered by GitHub Discussions. Sign in with GitHub to comment. Open the matching Discussion