Publishing Services with the Viaalink CLI
Publish local web applications, APIs, databases, and multi-port development environments through your Viaalink Relay.
Overview
The Viaalink CLI (via) provides simple commands to expose local development ports to the internet through your Viaalink Relay over secure, encrypted reverse tunnels.
Publishing HTTP web applications
Quick start
To publish a local development server running on port 3000:
via publish 3000via expose 3000 is supported as an exact alias:
via expose 3000Upon connection, the CLI displays your public address:
Local service: http://localhost:3000
Public address: https://d7f2a1.relay.example.comAny traffic arriving at https://d7f2a1.relay.example.com is automatically secured with Let’s Encrypt TLS and forwarded to your local port 3000.
Requesting a custom subdomain
If your Relay server is configured with --force-requested-subdomains=true, request a specific subdomain name using the --name flag:
via publish 3000 --name myappYour service is published directly at https://myapp.relay.example.com.
Adding password protection per link
When your Relay server runs with --bind-http-auth=true (the default), you can protect a published HTTP link with HTTP basic authentication by specifying user:password@ in the SSH reverse forward bind host:
ssh -p 2222 -R user:SecretPass123@myapp:80:localhost:3000 relay.example.comVisitors to https://myapp.relay.example.com are prompted for credentials before any request reaches your local application.
Publishing TCP and database services
For raw TCP port forwarding (such as databases, caches, and custom network protocols), use standard OpenSSH reverse port forwarding (ssh -R) or via connect -F <remote_port>:<local_port>:
# PostgreSQL via OpenSSH
ssh -p 2222 -R 5432:localhost:5432 relay.example.com
# MySQL via OpenSSH
ssh -p 2222 -R 3306:localhost:3306 relay.example.com
# Redis via OpenSSH
ssh -p 2222 -R 6379:localhost:6379 relay.example.comOr with via connect using the remote_port:local_port specification:
via connect -F 5432:5432The Relay binds an external port (random when --bind-random-ports=true, or the requested port when permitted) and reports the public connection endpoint:
Forwarded: relay.example.com:41285 -> localhost:5432Publishing multiple services at once
To publish multiple HTTP subdomains and TCP ports simultaneously through a single outbound tunnel connection, repeat the -F (--forward) flag for each forward specification (subdomain:local_port for HTTP, remote_port:local_port for TCP):
via connect -F web:3000 -F api:8080 -F 5432:5432This creates:
https://web.relay.example.com->localhost:3000(HTTP)https://api.relay.example.com->localhost:8080(HTTP)relay.example.com:<port>->localhost:5432(TCP)
You can also define multiple forwards via the VIAALINK_RELAY_FORWARD environment variable (which accepts a comma-separated list):
export VIAALINK_RELAY_FORWARD="web:3000,api:8080"
via connectAuto-reconnect and keepalive
For long-running sessions and unreliable networks, via connect enables automatic reconnection (--reconnect=true) and keepalive pings (--keepalive=30s) by default. You can customize the keepalive interval:
via connect -F app:3000 --reconnect --keepalive 10sOr configure environment variables:
export VIAALINK_RELAY_RECONNECT=true
export VIAALINK_RELAY_KEEPALIVE=10s
via connect -F app:3000Managing active tunnels
When you start a background tunnel with a --name (for example via publish 3000 --name myapp --daemon), manage active sessions by name:
# List all active background tunnels
via publish list
# Stop an active background tunnel by its assigned name
via publish stop myapp(via expose list and via expose stop <name> are also supported as aliases.)
Using standard OpenSSH (no CLI required)
Because Viaalink Relay speaks standard SSH reverse tunneling protocol, you can connect from any machine that has the standard ssh client installed without downloading the Viaalink CLI:
# Expose port 3000 with a random subdomain
ssh -p 2222 -R 80:localhost:3000 relay.example.com
# Expose port 3000 with a requested subdomain name
ssh -p 2222 -R myapp:80:localhost:3000 relay.example.com
# Expose port 3000 with HTTP basic authentication
ssh -p 2222 -R user:SecretPass123@myapp:80:localhost:3000 relay.example.com
# Forward a TCP port (e.g. database)
ssh -p 2222 -R 5432:localhost:5432 relay.example.comThis makes Viaalink Relay immediately usable on servers, continuous integration runners, and embedded systems where installing additional binaries is restricted.