Skip to content

Configuration

~/.nila-tunnel/nila.yaml — managed by register / deregister commands.

nila: "1.0.0"
logging:
max_size_mb: 50
max_files: 1
services:
- name: app.test
host: app.test
paths:
/:
target: 127.0.0.1:3000
- name: ai.test
host: ai.test
request_timeout: 30000
paths:
/v1/chat:
target: 127.0.0.1:8000
request_timeout: 120000
/health:
target: 127.0.0.1:8000
request_timeout: 5000

Paths are matched by longest prefix. Timeout priority: path > service.

FieldDefaultDescription
max_size_mb50Rotate log files when they exceed this size (MB)
max_files1Number of rotated files to keep (.1, .2, etc.)

Set per-path via CLI or per-service in nila.yaml:

Terminal window
nila-tunnel register -d ai.test -p 8000 --path /v1/chat --request-timeout 120000

Timeout in milliseconds. Returns 504 Gateway Timeout on expiry. WebSocket connections are excluded.

Terminal window
nila-tunnel register -d app.test -p 3000
nila-tunnel register -d ai.test --path /v1/chat -p 8000 --request-timeout 120000
nila-tunnel register -d app.com -p 3000 --allow-unsafe # non-safe TLD
FlagDefaultDescription
-p, --port3000Local port to proxy
-d, --domainlocalhost.testDomain name
--path/URL path prefix to route
-t, --target127.0.0.1:<port>Backend target address
--request-timeoutRequest timeout in ms
--allow-unsafeoffAllow non-reserved TLDs (.com, .io)
Terminal window
nila-tunnel deregister -d api.test
Terminal window
nila-tunnel start # launch proxy (daemon)
nila-tunnel start -F # foreground mode
nila-tunnel start --mode privileged # ports 80/443 (needs root)
nila-tunnel restart # stop + start
nila-tunnel stop # stop the proxy
FlagDefaultDescription
-F, --foregroundoffRun in foreground
--modeautoauto, privileged, unprivileged
--bind127.0.0.1Bind address
Terminal window
nila-tunnel status # human-readable
nila-tunnel status --json # machine-readable (AI agents)
nila-tunnel log # daemon logs
nila-tunnel log requests # structured request logs (JSONL)
nila-tunnel log requests -f # follow in real time

WebSocket connections are tunneled transparently. The proxy detects the Upgrade: websocket header and switches to bidirectional piping.

8443/ws
nila-tunnel register -d ws.test -p 5000

SSE streams pass through without buffering — events arrive in real time.

Terminal window
nila-tunnel register -d sse.test -p 7000
curl -Nsk https://sse.test:8443/events

JSON-RPC 2.0 at ~/.nila-tunnel/nila-tunnel.sock:

MethodParamsDescription
proxy_statusRunning state, PID, version
list_servicesAll registered services
add_service{host, port, path?}Register a service
remove_service{host}Deregister a service
reload_configReload routing table
Terminal window
echo '{"jsonrpc":"2.0","method":"proxy_status","id":1}' \
| socat - UNIX:~/.nila-tunnel/nila-tunnel.sock
~/.nila-tunnel/
├── ca.crt, ca.key Root CA (10-year validity)
├── nila-tunnel.pid Running proxy PID
├── nila-tunnel.log Daemon logs (rotated)
├── nila-tunnel.sock Unix socket (JSON-RPC)
├── nila.yaml Service config
├── logs/requests.jsonl Request logs (JSONL, rotated)
└── certs/<domain>/ Per-domain leaf certs (825-day validity)

RFC 6761 reserved TLDs are resolved automatically. Non-safe TLDs require --allow-unsafe.

  • .test, .localhost, .example, .invalid