Tondavo

How to open localhost on your phone

iPhone and Android. Updated

On a phone, localhost means the phone itself, so you need your computer's Wi-Fi address instead, such as http://192.168.1.20:5173. That's enough to check a layout. But a plain http:// address isn't a secure context, so the camera, microphone, WebCrypto, service workers and the clipboard API don't work there. For those you need HTTPS, or, on Android, Chrome's port forwarding.

The quick way: your computer's Wi-Fi address

  1. Make your dev server listen on the network, not only on your computer. Vite: npx vite --host, or server.host: true in the config. Next.js already listens on the network. Most other servers have a host option.
  2. Find your computer's address. Vite and Next.js print it as "Network". On a Mac: ipconfig getifaddr en0. On Windows: ipconfig, then the IPv4 address of your Wi-Fi adapter.
  3. With the phone on the same Wi-Fi, open http://<that address>:<port>.

If the page doesn't load:

  • Firewall. macOS asks whether to accept incoming connections for node; Windows blocks them on networks marked Public.
  • The network. Guest and office Wi-Fi often keep devices from seeing each other (client isolation). A VPN on either device can do the same.
  • The dev server. Next.js 16.2 and later loads the page but blocks hot reload from your Wi-Fi address until you add it to allowedDevOrigins. See Next.js on your phone. Vite allows IP addresses but blocks tunnel hostnames: see Vite's "Blocked request".

What breaks on a plain Wi-Fi address

Browsers enable powerful features only in a secure context: HTTPS, or localhost itself. Your Wi-Fi address is neither, so on the phone:

FeatureOn http://192.168.x.x
Camera and microphone (getUserMedia)navigator.mediaDevices is undefined
WebCrypto (crypto.subtle)Undefined, so login, encryption and hashing code fails
Service workers, offline mode, installing as an appNot available
Clipboard APInavigator.clipboard is undefined

The same code works on your computer at localhost, which is why these bugs show up only on the phone. You can check with window.isSecureContext. More in camera or microphone not working on a phone.

Getting a secure context on the phone

Android: Chrome port forwarding

Chrome on Android can reach your computer's localhost over USB, and it treats that as secure:

  1. Turn on USB debugging on the phone (Developer options) and connect it to the computer.
  2. In desktop Chrome, open chrome://inspect, choose Port forwarding, and forward your port (for example 5173) to localhost:5173.
  3. On the phone, open http://localhost:5173 in Chrome.

The same page gives you DevTools for the phone. It needs the cable and Chrome on both sides, and there's no iPhone equivalent.

A local certificate (mkcert)

mkcert creates a certificate authority on your computer and a certificate for your Wi-Fi address. Serve your app with that certificate, then install the authority (rootCA.pem from mkcert -CAROOT) on the phone. On an iPhone:

  • Install it in Settings, under General, VPN & Device Management.
  • Turn on full trust in Settings, under General, About, Certificate Trust Settings.

Android has its own path for installing a CA certificate in Settings, and some browsers ignore user-installed authorities. It's free and stays on your network. You do it on every test device, and re-issue the server certificate when your address changes.

A public tunnel (ngrok, Cloudflare Tunnel)

A tunnel gives your local server a public HTTPS address that works on any network, including mobile data. cloudflared tunnel --url http://localhost:5173 prints a random trycloudflare.com address with no account. ngrok's free plan shows a warning page to browsers before your app. The address is public, so anyone with the link can open your work in progress. Vite and Next.js also need the tunnel's hostname in their allowed lists.

Tondavo

Run npx tondavo in your project and point the phone's camera at the QR code. The phone opens your app at https://dev.tondavo.com, a real secure context (service workers are the exception: the edge refuses them, because all sessions share that address; test those with mkcert). Anyone else who opens that address is stopped at the edge. Nothing is installed on the phone, it works on mobile data, and Vite and Next.js need no config changes. Tondavo also passes on what the phone sees: errors, failed requests and taps that hit nothing appear in your terminal, and your AI coding agent can read them, see the screen and tap through the page.

Wi-Fi addressChrome port forwardingmkcertPublic tunnelTondavo
Best choice whenYou only check layoutYou test on Android and want full DevToolsTraffic must stay on your networkYou need a link anyone can open, or a webhookYou test device APIs on your own phone, or want your agent to use it
Secure contextNoYesYesYesYes
iPhoneYesNoYes, after trusting a certificateYesYes
AndroidYesYesYes, after installing a certificate; some browsers ignore itYesUntested
NeedsSame Wi-FiUSB cable, ChromeSetup per deviceAccount or random URLNode.js 22
Who can open itYour networkThat phoneYour networkAnyone with the linkOnly the paired phone
Errors from the phoneSeparate toolChrome DevToolsSeparate toolSeparate toolTerminal and agent tools
Traffic passes a third partyNoNoNoYes, the tunnel providerYes, Tondavo's edge on Cloudflare

Seeing errors from the phone

  • Android: chrome://inspect on the computer, with the phone on USB debugging.
  • iPhone: turn on Web Inspector in Settings, Apps, Safari, Advanced. Connect the phone to a Mac and open the page from Safari's Develop menu. There's no Apple version for Windows or Linux.
  • Tondavo: errors arrive in your terminal and in your agent's tools. It's tested on macOS with iPhone Safari and needs only Node.js 22. Android is untested.

To try it: npx tondavo. See Getting started.

Sources