Home / Localhost / Dev server not reachable from network

Dev server only works on localhost: expose Vite, Next.js, Angular

Make Vite, Next.js, Angular, Create React App and Django dev servers reachable from your phone or another computer with the host flag.

Most dev servers listen only on localhost, so a phone or another computer on the same Wi-Fi cannot open them. Tell the server to listen on all addresses, then open your computer's IP address with the port.

What to do, step by step

  1. Find your computer's local IP address, such as 192.168.1.25.
  2. Start the dev server with the host option for your tool (see the table below).
  3. On your phone, connected to the same Wi-Fi, open http://192.168.1.25:PORT with your own address and the port.
  4. If it still does not open, allow the port in your firewall for private networks.
  5. Turn the option off again when you are not testing, so your server is not open to the network.

Commands you can copy

Vite
npm run dev -- --host
Next.js
npx next dev -H 0.0.0.0
Django
python manage.py runserver 0.0.0.0:8000

Option for each tool

Vite
npm run dev -- --host or set server.host: true in vite.config.js.
Next.js
next dev -H 0.0.0.0
Angular
ng serve --host 0.0.0.0
Create React App
Set the variable first: HOST=0.0.0.0 npm start (on Windows use set HOST=0.0.0.0).
Django
python manage.py runserver 0.0.0.0:8000, and add your IP to ALLOWED_HOSTS.
Flask
flask run --host=0.0.0.0
Phone still cannot connect
Check both devices use the same Wi-Fi, a VPN is off, and the router does not use client isolation (a guest network setting).

Questions about Dev server not reachable from network

Is it safe to listen on 0.0.0.0?
On your home network it is fine for testing. On public Wi-Fi anyone nearby could open your dev server, so switch it off there.
What is my computer's IP address?
Run ipconfig on Windows or ifconfig / ip a on macOS and Linux and look for an address like 192.168.x.x. The open-from-phone page on this site shows how.
Why does it say "Network: use --host to expose"?
That is Vite telling you the server is localhost only. Add --host to share it on your network.

Updated 2026-10-11

Free tools that help

Related pages