Port Forwarding

View as Markdown

Access services running inside sandbox sessions through direct URLs or a local reverse proxy.

Direct URLs

If your application listens on a port inside the sandbox, access it through the session’s control endpoint:

  • Subdomain style: https://<session_id>.chaser.sh/forward/<port>/
  • Path style: https://api.chaser.sh/s/<session_id>/forward/<port>/

Both support HTTP and WebSocket traffic.

Local reverse proxy

Bind a local port to a sandbox service:

$chaser forward <session_id> <guest_port> [local_port] [--open] [--wait <seconds>]

Examples:

$# Forward guest port 3000 to local port 8080
$chaser forward <session_id> 3000 8080
$
$# Same, and open the browser automatically
$chaser forward <session_id> 3000 8080 --open
$
$# Wait up to 10 seconds for the upstream to be ready before serving
$chaser forward <session_id> 3000 8080 --wait 10

This binds http://127.0.0.1:<local_port> and proxies HTTP and WebSocket traffic to the sandbox.

SDK helpers

1// TypeScript
2const url = client.sessions.forwardUrl(session.id, 3000);
3
4// Python
5url = client.sessions.forward_url(session["id"], 3000)

Typical workflow

$# Start a dev server in the sandbox
$chaser shell <session_id> -c "cd /workspace && npm run dev -- --host 0.0.0.0"
$
$# In another terminal, open a local proxy
$chaser forward <session_id> 3000 8080 --open