Horizon

Share a MAMP, WAMP or XAMPP virtual host

Share a MAMP, WAMP or XAMPP virtual host such as mysite.test with a Horizon tunnel by passing the host name to hrzn tunnel.

Share a name-based virtual host from MAMP, WAMP or XAMPP, such as mysite.test, with a public HTTPS URL.

Before you begin

  • Node.js 18 or later
  • A Horizon account and the CLI (see Getting started)
  • A reserved subdomain for -s. Reserve one on the Subdomains page.
  • A virtual host that opens in your browser, for example http://mysite.test

Find the address you browse

Open your site in a browser and note the address, including the port. MAMP's default Apache port is 8888, so a MAMP site often opens at http://mysite.test:8888. XAMPP's default Apache port is 80, so the address has no port.

Start a tunnel with the host name

Pass the same address to hrzn tunnel. The CLI sets the Host header to the host of the URL you pass. Apache compares that value with each virtual host's ServerName and ServerAlias, and picks the matching one. With http://localhost, no name matches, and Apache serves the first virtual host it lists.

hrzn tunnel http://mysite.test -s my-app

For a MAMP site on port 8888, include the port.

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

Use -s with a subdomain you reserved. Without it, the subdomain is random and changes every run. Reserved subdomains are a paid feature, see Pricing. Keep this terminal open.

Check the app's site URL

Some apps store their own address and redirect to it. WordPress is the common case. Visitors on https://my-app.hrzn.run then land on http://mysite.test. Follow the WordPress guide to set the site URL.

Check it works

Open https://my-app.hrzn.run. On the first visit Horizon shows a Before you continue page. Select Continue to site. The page is the one http://mysite.test serves. The Horizon terminal prints one line per request:

Output
  GET     200  /

Troubleshooting

The tunnel shows a different site

Apache found no virtual host for the Host value, so it served the first one it lists. Check that the host in hrzn tunnel matches the ServerName or a ServerAlias of your virtual host.

The page redirects to mysite.test

The app stores its own address. Set the site URL in the app, see the WordPress guide.

The tunnel can't reach the host

The name has to resolve on your machine, because the CLI connects from there. Open http://mysite.test in your browser first. If it fails, fix the entry in your hosts file or your local DNS.

The URL changed after a restart

You started the tunnel without -s, so Horizon gave you a new random subdomain. Restart with -s my-app and the URL stays the same. -s needs a subdomain you reserved, see Pricing.

Next steps

On this page