Toggling internet access
When creating a sandbox, you can use theallowInternetAccess / allow_internet_access parameter to configure internet connectivity. Internet access is turned on by default, but it can be disabled for workloads with stricter security requirements.
Passing a falsy value to
allowInternetAccess / allow_internet_access has the same effect as adding ['0.0.0.0/0'] to network.denyOut / network.deny_out, which blocks every destination.Fine-grained network control
Network configuration provides finer-grained control over outbound traffic by allowing you to define allowlists and denylists.Allow and deny lists
IP addresses, CIDR blocks, or domain names that the sandbox is allowed to access can be specified.The CIDR
'0.0.0.0/0' / "0.0.0.0/0" is shorthand for “every destination”. An exported ALL_TRAFFIC constant resolves to the same 0.0.0.0/0 value if you prefer a named alternative to the literal.Domain-based filtering
You can specify hostnames inallowOut / allow_out to permit outbound traffic to selected domains. When domain-based filtering is enabled, all remaining traffic must be blocked through denyOut / deny_out. Domain entries are only supported in allow lists and cannot be used in deny lists.
Whenever a domain appears in the configuration, the default nameserver
8.8.8.8 is allowed automatically so that DNS resolution keeps working.Filtering by domain applies only to HTTP over port 80 (inspected via the Host header) and TLS over port 443 (inspected via SNI). Any other port falls back to CIDR-based matching, and UDP protocols such as QUIC/HTTP3 cannot be filtered by domain.
How blocked TCP connections behave
Because of the firewall architecture, a blocked outbound connection can still look successful from within the sandbox. The firewall must first accept the TCP connection before it can evaluate whether the target destination is permitted. As a result, code running inside the sandbox may see the connection succeed and the socket open, even if the destination is blocked. In that case, no traffic is actually delivered to the remote endpoint. To confirm that the destination is reachable, validate an application-level response instead of relying only on TCP connection success. For example, check for an HTTP status code, a completed TLS handshake, or the expected protocol response bytes. This behavior is a current limitation of how sandbox outbound traffic is routed through our firewall and may be updated in the future.Priority rules
If both allow and deny rules are configured, the allow rules take priority. Therefore, any IP address that appears in both lists will still be permitted.network settings take effect only when the sandbox is created — supply them to Sandbox.create. Once the sandbox exists, they are fixed and cannot be modified.
Sandbox public URL
Services in a sandbox can be accessed by using the sandbox’s public URL.Connecting to a server running inside the sandbox
You can connect to a server running inside the sandbox using the method described earlier; for example, start a lightweight HTTP server on port 3000 to serve files from its launch directory.Masking request host headers
You can use themaskRequestHost / mask_request_host option to customize the Host header sent to services running inside the sandbox. This is useful when your application expects requests to follow a specific host format.
${PORT} in the mask is substituted with the real port number of the service being addressed.