Why your phone can't open your local dev site on Windows

You type localhost:3000 on your phone and get an error. You try the PC's address instead and the page never loads. On a phone, localhost means the phone itself, and a request to the PC's address has to get past three checks: the dev server, Windows Firewall and the network between them.

This post covers each check, then shows how RepoYard's phone preview gets past them without changing the project.

The dev server has to accept requests from the network

A dev server only answers on the addresses it listens on, and some refuse requests that don't come from localhost. Vite and Next.js differ here:

ToolListens on by defaultTo open it to your phone
Vitelocalhost onlyStart it with --host, for example npm run dev -- --host
Next.jsEvery address (0.0.0.0)Add the PC's address to allowedDevOrigins in next.config. Without it, Next.js blocks dev-only requests from that address.

With the server open, find the PC's address with ipconfig (the IPv4 Address under your Wi-Fi adapter) and open http://that-address:port on the phone. The full steps are in Preview a Vite or Next.js app on your phone.

Windows Firewall has to let the connection in

The first time a program listens on the network, Windows Firewall asks whether to allow it. For a manual setup that program is node.exe. If you closed the prompt or allowed public networks only, the phone's request never reaches the server.

Network profileWhat the firewall does
PrivateLets in programs you allowed on private networks
PublicBlocks programs you allowed on private networks only. Windows picks this for networks it doesn't know.

Check how Windows sees your Wi-Fi: open Settings, then Network & internet, then Wi-Fi, select your network and look at Network profile type. On a home or office network you trust, choose Private.

The phone has to reach the PC

If the server is open and the firewall allows it, the problem is usually the network or the app itself.

What you seeLikely cause
The page never loadsThe phone is on a different network, a guest Wi-Fi, or mobile data. Guest networks often keep devices apart.
Works at home, not at the officeThe office Wi-Fi isolates devices from each other. Ask IT, or use a network you control.
The wrong addressA VPN, WSL or Docker adapter on the PC has its own address. Use the Wi-Fi or Ethernet one.
The page loads but data doesn'tThe app calls an API at localhost, which on the phone means the phone. Point it at the PC's address.

RepoYard opens it with one button

Press the phone button on a running dev server, in the board's Live list or the repo's Dev servers. Preview on a phone shows a QR code and an address on your local network. Scan it with the phone's camera.

RepoYard listens on the network itself and passes each request to the dev server on localhost. It rewrites the Host, Origin and Referer headers so Vite and Next.js see a local request. You don't add --host or allowedDevOrigins, and live reload keeps working. It shows the Wi-Fi or Ethernet address, not one from a VPN, WSL or Docker.

The firewall still asks once. This time the program is RepoYard: allow it on private networks.

The Preview on a phone dialog shows a QR code, the address http://192.168.1.24:52000 and the note that it opens atlas-web on port 3000 from this PC.
One QR code per dev server. The project's config stays as it is.

One QR code per dev server. The project's config stays as it is.

The Preview on a phone dialog shows a QR code, the address http://192.168.1.24:52000 and the note that it opens atlas-web on port 3000 from this PC.

On a small screen, scroll across to read the full capture. Open original image

See what is shared, and stop it

A shared dev server says "on network" in the Live list, and its phone button stays highlighted. Hover it to see the address again.

Sharing ends when you choose Stop sharing, or a few seconds after the dev server stops. If the dev server restarts on another port, the shared address follows it, so the phone keeps working.

In the Live list, atlas-web shows on network, and a tooltip reads Shared on your network at http://192.168.1.24:52000. Click to show the code or stop sharing.
Shared dev servers are marked in the Live list.

Shared dev servers are marked in the Live list.

In the Live list, atlas-web shows on network, and a tooltip reads Shared on your network at http://192.168.1.24:52000. Click to show the code or stop sharing.

On a small screen, scroll across to read the full capture. Open original image

What RepoYard does not do

  • The preview works on your local network only. It isn't a public link for someone elsewhere.
  • The address is plain http. Browser features that need https, such as the camera or service workers, may not work on the phone.
  • It doesn't change your app's code, so API calls to localhost still need fixing in the app.
  • It can't get past a guest or office Wi-Fi that keeps devices apart.

Try it on your own repos.

Windows 10 and 11, x64. Every feature for 7 days, then US$39.99 once. No RepoYard account needed.

Get RepoYard from Microsoft