How to share localhost with someone
A localhost address only works on your own computer. Give your dev server a public https link instead, so a client or teammate can open it anywhere.
Updated
You send a client http://localhost:3000 and they get “This site can't be reached”. Nothing is wrong with your site. The address means something else on their computer.
Why a localhost link only works for you
localhost is the name every computer gives itself. When your client opens http://localhost:3000, their browser looks for a server on port 3000 of their own computer, finds none, and gives up. Your phone does the same.
Your computer's address on the local network, like 192.168.1.20, gets closer. Devices on the same Wi-Fi can reach it once your dev server listens beyond localhost, which is handy for your own phone (see how to open localhost on your phone). A client in another office still can't. For anyone, anywhere, your site needs a public address that leads back to your computer.
How a localhost tunnel works
A tunnel gives your port that public address. A small program on your computer opens a connection out to a server on the internet and keeps it open. When someone visits the public address, the server passes their request down that connection to your port, and your dev server's answer goes back the same way.
Because your computer opens the connection, there is nothing to change on your router and no port to open in a firewall. Visitors reach only the one port you share, and only while the program runs.
ouicu works this way. ouicu share 3000 gives port 3000 an address like https://calm-otter-4821.ouicu.app.
Share your dev server
Install and log in
On macOS and Linux, install the command line tool with:
curl -fsSL https://ouicu.com/install.sh | shOn Windows, run this in PowerShell:
irm https://ouicu.com/install.ps1 | iexThen log in. It opens ouicu.com in your browser, where you approve this computer:
ouicu loginYou need a ouicu account to log in. ouicu is in a closed beta, so accounts are for people we have invited: write to [email protected] to join.
Share the port
Start your dev server as usual. Then, in a second terminal, share the port it listens on: often 3000 for Next.js, 5173 for Vite, 4321 for Astro and 8000 for Django.
ouicu share 3000 Live at https://calm-otter-4821.ouicu.app Forwarding to localhost:3000 It stops in 2 h, the longest a share runs on your plan. Visitors see a short notice from ouicu before your page. Ctrl-C to stop.Send that link. It opens on laptops, phones and tablets, on any network. Each request shows in your terminal as it happens, so you can tell when someone is looking. Press Ctrl-C to stop sharing.
What they see
- Your site at an https address, as if it were hosted. Hot reload still works: save a file and the page updates on their screen too.
- On Free, a short notice from ouicu comes first, saying the page runs on someone's computer. Each browser sees it once a week for each share. On Hobby and Pro, links open straight to your page.
- A small Report button in a corner of every page, so anyone can tell ouicu about a preview that looks wrong. Reports go to ouicu, not to you.
- If your dev server isn't running, a page saying the site isn't running yet, with a Try again link.
Keep it to the people you send it to
A random link is hard to guess, but anyone who has it can open it, and links get forwarded. For client work, put a password on it:
ouicu share 3000 --passwordOr let in only the people you name. They type their email address and get a link to open it, with no account to make:
ouicu share 3000 --allow [email protected],@acme.comPasswords come with Hobby and Pro, invite lists with Pro. See Password-protect a staging site for both.
Keep the same link
On Free, every ouicu share draws a new random name, and a share stops after 2 hours. That's fine for a quick look. For a client you'll show work to again, keep a name:
ouicu share 3000 --name studiolundOn Hobby and Pro, the first use reserves studiolund.ouicu.app for you, so next week's link is the same as today's. Shares on Hobby and Pro have no time limit.
If your laptop sleeps or the Wi-Fi drops, the share reconnects at the same address when it can. While it's away, a reserved name on Hobby and Pro shows visitors the pages they last loaded, with a note that the live preview is offline.
No dev server settings to change
Dev servers guard against addresses they don't know. Vite only answers hosts in its server.allowedHosts setting, and Next.js blocks requests for its dev resources, like hot reload, from origins outside allowedDevOrigins. With a tunnel that passes the public address on, you would add it to both.
ouicu passes each request on as if it came to localhost on your port, so neither needs a change. The public address arrives in the X-Forwarded-Host header, with X-Forwarded-Proto: https. A redirect your server sends to http://localhost:3000 reaches the visitor as the public link.
When the link doesn't load
- “The site isn't running yet”: nothing listens on the port you shared. Start your dev server, or check the port number.
- A page saying something isn't shared through ouicu: ouicu passes on web pages, not videos, audio, downloads or responses over 50 MB. Put a video on a video service and embed it from there.
- “Nothing is shared here”: the share ended, or the link has a typo. Run
ouicu shareagain, and with a random name, send the new link.
The rest is in Sharing a port, under Troubleshooting.