Exposed sandbox URLs are public. Add authentication inside the application before exposing sensitive data or operations. Outbound network restrictions do not authenticate inbound requests. The application must listen on the exposed port on
0.0.0.0 or ::; creating a URL does not start a server.Exposing Ports
You can expose ports from your Sandbox in two ways: statically at creation time, or dynamically at runtime.Static Port Exposure
Specify ports when creating the sandbox to have them exposed immediately with public URLs:Dynamic Port Exposure
You can also expose ports dynamically after the sandbox is created using theexpose_port() method.
Expose a port
Expose multiple ports
List exposed ports/preview URLs
Network Security
Blocking Outbound Traffic
You can block all outbound network access from your Sandbox while still allowing inbound connections to exposed ports. This is useful for security-sensitive workloads or when executing untrusted code.block_network=True and no runtime secrets, the sandbox cannot initiate outbound connections. With brokered secrets, only their approved credential hosts are reachable. Exposed ports remain accessible in either case.
Allow Lists
Allow only specific hostnames, wildcard domains, IPs, or CIDRs. Other destinations are blocked:/32 for IPv4, /128 for IPv6). Wildcards match subdomains, excluding the apex; hostname rules contain no scheme, port, or path. Hostname rules inspect TLS SNI on port 443 or HTTP Host on port 80 and resolve hosts on the worker. Other TCP ports and protocols need IP or CIDR rules. The proxy rejects private, loopback, and link-local destinations even with an explicit IP/CIDR rule; allowlists do not create private-network access. Under restricted policies, UDP/ICMP are blocked except DNS to the configured resolver.
Do not combine an explicit allow_list with block_network=True. Credential host rules must fit within an explicit allowlist’s hostname rules; IP/CIDR entries alone do not cover them, and a secret does not widen the list. Without network restrictions, other public destinations remain reachable but only approved hosts receive substituted credentials. Worker-proxied connections use the worker’s source IP, including CIDR targets.