Stable application URLs
Run a service on0.0.0.0 and publish its port:
/, root-relative assets, redirects, and WebSockets use that origin without a VM path prefix. Always use the URL returned by Beam instead of constructing a hostname yourself.
get_url() only retrieves an already published URL; it does not expose a private port. Removing a published route does not stop the service:
Protect a published port
An ordinary published URL is accessible to anyone who has it. A random hostname is not a substitute for authentication. Protect sensitive services, especially the root browser terminal and desktop:ports and protected_ports when creating application ports, or call expose(port, protected=True):
Browser access
beam vm desktop NAME and beam vm terminal NAME generate an expiring entry URL automatically when their port is protected. Opening it exchanges the session credential for an HTTP-only cookie scoped to that port’s host, then redirects to the stable URL.
For another protected application, generate an entry URL in Python:
Programmatic access
For HTTP clients, use the VM traffic token inX-Beam-VM-Token. This token is distinct from your workspace API token:
vm.traffic_access_token and vm.rotate_access_token(). The token is consumed by the gateway and is not forwarded to the application.
Private TCP forwarding
Keep a database or other TCP service private and connect through localhost:127.0.0.1; the command keeps running until you stop it.
Equivalent syntax is beam vm port-forward devbox 5432 --local-port 15432. Port forwarding binds an unpublished port for authenticated tunnels without creating a public HTTP URL. SSH uses the same private transport.
In Python, vm.bind(5432) makes a port available to authenticated tunnels without publishing it. The low-level beam vm tunnel NAME PORT command bridges a tunnel through stdin/stdout, for tooling integrations; use ssh or port-forward for normal interactive use.
Outbound network controls
Block all outbound traffic or allow only specific IP ranges:203.0.113.0/24 is an example range; replace it with the real CIDRs your application needs. These controls persist across restarts. Do not combine blocking all traffic with an allow list.
--block-network or repeat --allow-network CIDR at creation for the same policy. Image building happens separately from guest runtime egress controls. Blocking outbound traffic also prevents apt, pip, agent APIs, and other external downloads unless their destinations are allowed.
Egress restrictions do not protect inbound URLs. Configure published-port protection independently.