Skip to content
Browse the docs
getting started

Quick Start

Create your first tunnel in 2 minutes

Go from nothing installed to a public URL forwarding to your local server in under 2 minutes.

Install

If you haven't already, install the CLI (a single binary; on Linux it needs glibc 2.28 or newer):

bash
# macOS / Linux
curl -fsSL https://zgrok.io/install.sh | sh
powershell
# Windows (PowerShell)
irm https://zgrok.io/install.ps1 | iex

Verify it worked:

bash
zgrok --version

See Installation for manual downloads and platform binaries.

Pick your framework

Pick what you are running to see its run command, its default port and the one setting most frameworks need before they accept a tunnel. If the port differs from 3000, use it in step 2 instead of 3000.

What are you running?

Let Vite accept the tunnel's address

Without this, the tunnel connects but the page shows:Blocked request. This host ("quiet-river--acme-shop.zgrok.io") is not allowed.
vite.config.js
export default defineConfig({
  server: {
    allowedHosts: [".zgrok.io"],
  },
});

Since early 2025 Vite refuses unknown Host headers by default. The leading dot allows every zgrok address, which matters because free addresses change.

Start your app, then the tunnel

bash
# terminal 1
npm run dev
# terminal 2
zgrok http 5173

Sign in

bash
zgrok login

The CLI prints a short code and opens your browser. Check that the code matches, approve it, and the CLI saves an API key to ~/.zgrok/config.yaml. You only do this once on each machine.

The browser page zgrok login opens: Sign in the CLI?, a code SP2Z-4B7B to compare with the terminal, the machine Janes-MacBook-Pro, platform macos-aarch64, CLI v0.30.1, the organization Acme Inc, and the buttons Approve this machine and Deny.

On a machine with no browser, such as over SSH, it prints the URL instead, so you can approve from any device. zgrok login --no-browser does the same anywhere.

1. Start your local server

Make sure you have a local server running. For example:

bash
# Node.js
npx serve -p 3000
 
# Python
python -m http.server 3000
 
# Any framework (Next.js, Rails, Django, etc.)
# Just make sure it's running on a port

2. Start a tunnel

bash
zgrok http 3000

You'll see the tunnel come online, then each request as it arrives:

Text version
$ zgrok http 3000
 
zgrok v0.30.1
 
→ Connecting to relay.zgrok.io:4433...
→ Authenticating...
 
Tunnel Status: online
Project: acme-shop (switch: zgrok project)
Forwarding: https://bnu5xt--acme-shop.zgrok.io → http://localhost:3000
temporary address: replaced after 24 hours, or when you restart zgrok
keep an address: https://zgrok.io/pricing
Requests: https://zgrok.io/dashboard/tunnels/ucy3gbytcd6z7ky0mprkq7wy/logs
Inspect: http://127.0.0.1:4040
 
→ Press Ctrl+C to stop the tunnel
 
[00:27:05] GET / 200 2ms
[00:27:06] GET /api/products 200 2ms
[00:27:06] POST /webhooks/payments 200 1ms
[00:27:07] POST /api/orders 422 1ms
[00:27:07] POST /api/orders 201 2ms
[00:27:08] GET /favicon.ico 404 1ms

Requests opens this tunnel's log in your dashboard, for when you need to scroll back further than the terminal.

Inspect is the request inspector, running on your own machine: every request through the tunnel with its full headers and body, and a button to replay any of them against your local app. It runs by default; --no-inspect turns it off.

3. Access your tunnel

Open the Forwarding URL in any browser. Your local server is now accessible from the internet. To test it from your phone, add --qr and scan the code zgrok prints instead of typing the URL:

bash
zgrok http 3000 --qr

4. Name your tunnel

Every tunnel lives inside one of your projects, and its address is the tunnel's name followed by the project: a7f9x2--acme-shop.zgrok.io is the tunnel a7f9x2 in the project acme-shop. By default zgrok assigns a random name, and on Free it changes every time you start a tunnel. Name your tunnels inside your project with --subdomain:

bash
zgrok http 3000 --subdomain api

Your tunnel is now reachable at https://api--acme-shop.zgrok.io, which is useful for a webhook URL you don't want to re-register every restart. Custom tunnel names are a PRO plan feature; see Plans & Limits for details.

Your dashboard lists every tunnel in the project, live or not, with the requests each one received:

The Tunnels page of the Storefront project: two live tunnels, api--acme-shop.zgrok.io and web--acme-shop.zgrok.io, a saved name webhooks--acme-shop.zgrok.io that is not running, and on the right the api tunnel's recent requests with their methods, paths, status codes and durations.

5. Inspect requests

As requests come in, they're printed in your terminal in real time:

[14:32:05] GET / 200 12ms
[14:32:06] POST /api/webhook 200 45ms
[14:32:07] GET /assets/style.css 304 3ms

Method, status, and latency are all color-coded for quick scanning. See Request Logging for the full format and how to turn it off with --no-log.

6. Stop the tunnel

Press Ctrl+C to gracefully disconnect:

→ Shutting down tunnel...
✓ Tunnel disconnected gracefully

Troubleshooting your first run

  • "Connection failed" on startup: check nslookup relay.zgrok.io; if you're behind a corporate firewall, QUIC (UDP port 4433) may be blocked.
  • "API key required": run zgrok login, or pass --api-key / set ZGROK_API_KEY for a single run.
  • 502 from your tunnel URL: your local server isn't running on the port you passed to zgrok http.

Full list of fixes: Troubleshooting.

What's next?