Horizon

Share your local dev site

Share your local dev site with a teammate or client. Send them a public HTTPS link to localhost with a Horizon tunnel.

Send a teammate or client a link to the site running on your laptop. They open it in a browser, with nothing to install.

Before you begin

  • Node.js 18 or later
  • A Horizon account and the CLI (see Getting started)
  • A dev server running on your machine, for example on http://localhost:3000
  • Optional: a reserved subdomain for -s. Reserve one on the Subdomains page.

Start your site

Start your dev server as you always do.

npm run dev

Start a tunnel

Pick one of two ways. Both give you an HTTPS URL.

Random subdomain. Free, and right for a one-off share. The subdomain changes every time you restart the tunnel.

hrzn tunnel http://localhost:3000

Reserved subdomain. The link stays the same across restarts, so a client can bookmark it. Reserve the name first on the Subdomains page. Reserved subdomains are a paid feature, see Pricing. Use this one for anything you share more than once.

hrzn tunnel http://localhost:3000 -s my-app
Output
HORIZON: Tunnel connected
  URL          https://my-app.hrzn.run (reserved)
  Forwarding   http://localhost:3000
  Request log  https://hrzn.run/dashboard/tunnels/my-app

Keep this terminal open. The tunnel stops when you press Ctrl+C.

Copy the URL row and send it. Tell the visitor what they will see first. The next section shows it.

What your visitor sees

The first time a visitor opens the link in a browser, Horizon shows a Before you continue page. They select Continue to site and land on your site.

Horizon shows that page once every 7 days per IP address. A visitor who comes back later the same week goes straight to your site.

Check it works

Open your URL in a browser. Select Continue to site on the Before you continue page. Your site loads.

Your Horizon terminal prints one line per request:

Output
  GET     200  /

Edit a file in your project. If your dev server supports hot reload, the page updates in the visitor's browser. It works because WebSockets pass through the tunnel.

Troubleshooting

Visitors see a Before you continue page

This is expected. It appears once every 7 days per IP address. Tell the visitor to select Continue to site.

You started the tunnel without -s, so Horizon gave you a new random subdomain. Send the new URL, or reserve a subdomain and start with -s my-app. See Pricing.

The page loads but hot reload doesn't update

Check that your dev server's hot reload works on http://localhost:3000 first. Horizon passes WebSockets through, so a dev server that reloads locally should reload through the tunnel. Some dev servers need their reload socket pointed at the public host. Check your framework's docs.

The CLI sets the Host header to localhost:3000. An app that builds absolute URLs from Host builds localhost ones. Set the public URL in your app's config, or read X-Forwarded-Host, which carries the public host.

Nothing loads

  • Check that the Horizon terminal is still running. If its last line is Connection lost. Reconnecting…, wait for Reconnected.
  • Check that your dev server runs on the port in the hrzn tunnel command.

Next steps

On this page