API token. Takes precedence over the one stored by tunnex login; use it in containers and CI.
TUNNEX_SERVER
Server to connect to, e.g. wss://connect.example.com (default: wss://connect.tunnex.org). Same as --server.
TUNNEX_HOME
Directory for the profile and the local request store (default ~/.tunnex; /data in the client image).
TUNNEX_CONFIG
Path of the file tunnex start reads (default tunnex.yaml).
TUNNEX_INSPECTOR_PORT
Local inspector port (default 4040; the next free port is used if it is busy).
TUNNEX_INSPECTOR_HOST
Inspector bind address (default 127.0.0.1; 0.0.0.0 in the client image — publish the port to localhost only).
TUNNEX_INSPECTOR_HOSTS
Extra Host header values the inspector accepts, comma-separated (e.g. tunnex:4040 inside a Compose network).
TUNNEX_NO_INSPECTOR
1 disables the inspector.
TUNNEX_LOGIN_TOKEN
tunnex login stores this token instead of opening the browser.
TUNNEX_INBOX_SECRET
Signing secret for tunnex inboxes create, so it does not end up in shell history.
TUNNEX_LOG_LEVEL
Python log level of the client (WARNING by default).
Precedence: command-line option > environment > stored profile > default. In tunnex start, inspector values
written in tunnex.yaml win over TUNNEX_INSPECTOR_*, and the file's server: wins over TUNNEX_SERVER.
tunnex start runs every tunnel and listener of a YAML file — the entry point of the client image. tunnex start
--check validates the file without connecting.
version: 1
server: ${TUNNEX_SERVER:-wss://connect.tunnex.org} # optional
inspector:
enabled: true
host: 0.0.0.0 # values set here win over TUNNEX_INSPECTOR_HOST / _PORT
port: 4040
hosts: ["tunnex:4040"]
tunnels:
web:
addr: app:3000 # port, host:port or URL (http/https, with a base path)
proto: http # http | tcp
subdomain: acme-preview # needs an account; reserved automatically
basic_auth: ["demo:${DEMO_PASSWORD}"]
keys: [] # API keys callers must send (Bearer or X-Api-Key)
allow_ips: ["203.0.113.0/24"]
allow_emails: ["@example.com"] # Tunnex SSO (needs GitHub sign-in on the server)
allow_paths: ["/api/"]
rate_limit: 600 # requests per minute at the edge
host_header: rewrite # rewrite | preserve | <value>
inspect: true # record traffic in the local inspector
listeners:
stripe:
inbox: acme-stripe # or a list of inboxes
forward: http://app:3000 # the event path is appended
filters: ["json.livemode=false"]
from: cursor # cursor | now | 30m / 6h / 2d | <event id>
name: staging # subscription name (default: <hostname>-<key>)
host_header: rewrite
inspect: true
${VAR} and ${VAR:-default} are replaced from the environment; a missing variable without a default is an
error. Numbers may be written unquoted.
Unknown keys are errors, so typos fail fast.
A token: key is rejected: tokens come from TUNNEX_TOKEN only.
A YAML file at TUNNEX_CONFIG (the server image ships one with server.bind: 0.0.0.0).
Environment variables override the file: every key as TUNNEX_<SECTION>__<KEY> (double underscore, e.g.
TUNNEX_WEBHOOKS__MAX_BODY_BYTES=2097152, TUNNEX_LIMITS__FREE__CONCURRENT_TUNNELS=20), plus the short
aliases below. List values are comma-separated.
Unknown keys are errors; the server refuses to start and lists every problem.
Secrets (TUNNEX_SECRET_KEY, the database password, the GitHub client secret) belong in the environment, never
in the file.
Alias
Key
TUNNEX_SECRET_KEY
auth.secret_key
TUNNEX_DATABASE_URL
database.url
TUNNEX_DOMAIN
server.domain
TUNNEX_CONTROL_HOST
server.control_host
TUNNEX_PUBLIC_SCHEME / TUNNEX_PUBLIC_PORT
server.public_scheme / server.public_port
TUNNEX_HTTP_PORT
server.http_port
TUNNEX_BIND
server.bind
TUNNEX_GITHUB_CLIENT_ID / _SECRET
auth.github.client_id / client_secret
TUNNEX_METRICS_PORT
metrics.port
TUNNEX_LOG_LEVEL / TUNNEX_LOG_FORMAT
logging.level / logging.format
Configuration files written for earlier releases are accepted: database.path, server.host, tcp_udp and
the ssl/client sections are translated or ignored.
Required over HTTPS. Signs sessions and links, and derives the key that encrypts inbox secrets — changing it invalidates both. Generate with openssl rand -base64 48.
signup_enabled
true
Allow new accounts.
anonymous_tunnels
true
Allow tunnels without an account. Set to false on private servers: clients get login_required.
session_days
30
Console session lifetime.
github.client_id / client_secret
—
"Sign in with GitHub"; also enables email SSO for tunnels (it trusts only GitHub-verified emails). Callback: https://<control_host>/auth/github/callback.