Exposes any local HTTP server through your own WebHop gateway
320
Expose any local HTTP server through your own WebHop gateway, much like ngrok http. The local server needs no WebHop code and doesn't have to be .NET. webhop opens no listening port: it only connects out to the gateway and to your local server.
You need a running gateway; see WebHop.Gateway.
dotnet tool install -g webhop
Or download the standalone Native AOT binary, which runs without .NET, and unpack it somewhere on your PATH:
On macOS, a binary downloaded with a browser is quarantined; clear that with xattr -d com.apple.quarantine webhop.
webhop config add-gateway-url https://my-gateway.example.com/
webhop config add-authtoken <token>
webhop http 5000
WebHop (Ctrl+C to quit)
Session Status online
Version 2.0.0
Origin Id 5c11642ef14844fb98e6cfcb5ac6ea99
Tunnels 10/10 open
Forwarding https://my-gateway.example.com -> http://localhost:5000
Connections ttl opn p50 p90
6 0 17 ms 46 ms
HTTP Requests
-------------
01:51:47 GET /slow 200 OK 1,5 s
01:51:45 GET /missing?x=1 404 Not Found 17 ms
The commands and flags follow ngrok's.
| Command | What it does |
|---|---|
webhop http 5000 | Forward to http://localhost:5000; also accepts localhost:5000 or a full URL such as https://localhost:7001 |
webhop config add-gateway-url <url> | Save the gateway to connect to |
webhop config add-authtoken <token> | Save the gateway's auth token |
webhop config check / config edit | Show or edit the saved settings |
webhop version | Show the version |
webhop help [command], webhop <command> --help | Usage and all flags |
Flag for webhop http | Meaning |
|---|---|
--url | Gateway URL, which is also the public URL. Default: WEBHOP_URL, then the saved gateway |
--authtoken | The gateway's auth token. Default: WEBHOP_AUTHTOKEN, then the saved auth token |
--host-header=rewrite | Send Host: localhost:<port>, for dev servers that reject other hosts (Vite, webpack dev server) |
--log=stdout|stderr|<file> | stdout/stderr print log lines instead of the live screen (also used when output is redirected); a file path keeps the screen and writes the log to the file |
--log-level=debug|info|warn|error|crit | How much to log (default info) |
--log-format=term|json | Log line format |
--config | Use another config file |
--connections | Tunnels to keep open (WebHop-specific) |
Flags can come in any order, before or after the command, as --flag value or --flag=value.
The settings are saved in %APPDATA%\webhop\webhop.json on Windows and ~/.config/webhop/webhop.json elsewhere.
The elebree/webhop-cli image on Docker Hub (also ghcr.io/elebree/webhop-cli) runs webhop on linux/amd64 and linux/arm64, for tunnels that run unattended next to other containers. Each release is tagged with its version (2.1.0), its minor version (2.1) and latest; edge is the newest build of main.
Pass the gateway and the auth token as environment variables. Inside a container localhost is the container itself, so reach a server on the host as host.docker.internal (on Linux, add --add-host=host.docker.internal:host-gateway):
docker run --rm -it -e WEBHOP_URL=https://my-gateway.example.com/ -e WEBHOP_AUTHTOKEN=<token> elebree/webhop-cli http http://host.docker.internal:5000
-it shows the live screen; without it, webhop prints log lines. In Docker Compose, it exposes another service of the stack by its service name:
services:
app:
image: my-app
tunnel:
image: elebree/webhop-cli
command: http http://app:8080
environment:
WEBHOP_URL: https://my-gateway.example.com/
WEBHOP_AUTHTOKEN: ${WEBHOP_AUTHTOKEN}
restart: unless-stopped
X-Forwarded-For/Proto/Host.dotnet run --project WebHop.CLI -- http 5000.Content type
Image
Digest
sha256:6fa309921…
Size
12.6 MB
Last updated
8 days ago
docker pull elebree/webhop-cli