Tutorials

Expose Your Local Server to the Internet in Under a Minute

A step-by-step guide to installing rustunnel, configuring authentication, and creating your first HTTP tunnel — with real commands and terminal output.

João Henrique··5 min read

You need a public URL for your local development server. Maybe you're testing a Stripe webhook, debugging an OAuth flow, or sharing a work-in-progress with a client. Whatever the reason, rustunnel gets you there fast.

Here's how to go from zero to a live HTTPS tunnel in under a minute.

Prerequisites

Install the rustunnel client. There are three ways — pick whichever you prefer.

macOS and Linux (Homebrew) — the easiest option, no Rust toolchain required:

brew tap joaoh82/rustunnel
brew install rustunnel

This installs both rustunnel (the CLI client) and rustunnel-mcp (the MCP server for AI agent integration).

Pre-built binary — download the archive for your platform from the latest GitHub release and move the binary onto your PATH. Available for macOS (Apple Silicon + Intel), Linux (x86_64 + arm64), and Windows.

Build from source — requires Rust 1.76+:

git clone https://github.com/joaoh82/rustunnel.git
cd rustunnel
cargo build --release -p rustunnel-client
sudo install -Dm755 target/release/rustunnel /usr/local/bin/rustunnel

Verify the installation:

rustunnel --version

Step 1: Get an Auth Token

Sign up at rustunnel.com, then go to Dashboard → API Keys → Create token. You'll get a token starting with rt_live_.

Step 2: Run the Setup Wizard

rustunnel includes an interactive setup that creates a config file at ~/.rustunnel/config.yml:

rustunnel setup

You'll be prompted for three things:

PromptWhat to enter
Server addressPress enter for the default (auto-selects nearest region)
Auth tokenPaste your rt_live_ token
RegionPress enter for auto (probes all regions and picks nearest)
rustunnel setup — create ~/.rustunnel/config.yml

Tunnel server address (eu / us / ap).edge.rustunnel.com:4040:
Auth token (leave blank to skip): rt_live_abc123xyz
Region [auto / eu / us / ap] (default: auto):

Created: /Users/you/.rustunnel/config.yml
Run `rustunnel start` to connect using this config.

The generated config file looks like this:

# rustunnel configuration
server: eu.edge.rustunnel.com:4040
auth_token: rt_live_abc123xyz
region: auto
 
# tunnels:
#   web:
#     proto: http
#     local_port: 3000
#   api:
#     proto: http
#     local_port: 8080
#     subdomain: myapi

Region auto-selection probes all edge servers in parallel and picks the nearest. If you're in Europe, you'll see something like: eu 12ms · us 143ms · ap 311ms → eu (Helsinki, FI) 12ms.

Step 3: Start Your Local Server

This works with anything — Next.js, Express, Django, Rails, a plain HTTP server:

npm run dev

Your app is running on http://localhost:3000. That's all you need on the local side.

Step 4: Create the Tunnel

In a new terminal:

rustunnel http 3000

You'll see a spinner while it connects, then a startup box with your public URL:

╭────────────────────────────────────────────────────────────╮
│                         rustunnel                          │
├────────────────────────────────────────────────────────────┤
│  HTTP [default] → localhost:3000                           │
│   https://a1b2c3d4.eu.edge.rustunnel.com                  │
╰────────────────────────────────────────────────────────────╯

  ✓ Tunnels active. Press Ctrl-C to quit.

That URL is live. It has automatic TLS termination — your local server doesn't need HTTPS. Anyone on the internet can now reach your local app.

Requesting a Custom Subdomain

If you're on the pay-as-you-go plan, you can reserve a subdomain with the --subdomain flag:

rustunnel http 3000 --subdomain myapp

Now your tunnel is at https://myapp.eu.edge.rustunnel.com — a stable URL you can configure as a webhook endpoint in Stripe, GitHub, or anywhere else.

Tunneling Raw TCP

rustunnel isn't limited to HTTP. Need to expose a database, SSH, or any TCP service?

rustunnel tcp 5432

The server assigns a public port and displays it in the startup box. The connection is encrypted end-to-end through the same WebSocket transport.

Multiple Tunnels at Once

For more advanced setups, define named tunnels in your config file and start them all with a single command:

server: eu.edge.rustunnel.com:4040
auth_token: rt_live_abc123xyz
 
tunnels:
  frontend:
    proto: http
    local_port: 3000
    subdomain: app
  backend:
    proto: http
    local_port: 8080
    subdomain: api
rustunnel start

All tunnels share a single control connection, so there's no overhead for running several at once.

What Happens When the Connection Drops

By default, rustunnel reconnects automatically with exponential backoff:

AttemptDelay
1~1 s
2~2 s
3~4 s
4~8 s
n≥6~60 s (max)

Each delay has random jitter to prevent thundering-herd reconnects. If you need a one-shot connection (e.g., for CI), use --no-reconnect:

rustunnel http 3000 --no-reconnect

Cleaning Up

Press Ctrl-C to cleanly close the tunnel. The control WebSocket is closed gracefully before the process exits.

That's it. From install to a live HTTPS URL in under a minute. If you want to run your own tunnel server instead of using the managed service, the self-hosting guide covers deploying on any VPS with Docker and automatic TLS.