Skip to main content
Bring your own proxy is currently in private beta. If you’d like access, please reach out to us at support@e2b.dev.
You can give E2B the address of a SOCKS5 proxy you operate, and every outbound TCP connection from the sandbox is dialed through it. Unlike proxy tunneling, nothing runs inside the sandbox. There is no custom template, no proxy client, and no in-guest configuration, so the code running in the sandbox cannot see the proxy or route around it. Typical reasons to use it:
  • Give all sandbox traffic a stable, allowlistable source IP. E2B does not offer static egress IPs on any plan, see Egress IP ranges.
  • Reach a corporate network, a VPN, or internal services that only accept traffic from your own network.
  • Log or inspect sandbox egress in your own infrastructure.

How it works

  • Tunneling happens on the host, after filtering. Your allow and deny lists are evaluated first, so a connection that denyOut blocks never reaches your proxy. See Internet access for the filtering rules.
  • TCP only. UDP based traffic, including DNS and QUIC or HTTP/3, is not tunneled. It leaves the sandbox the usual way and stays subject to your allow and deny lists.
  • Domain matched connections use remote DNS. When a connection is allowed by a domain entry in allowOut, E2B hands the hostname to your proxy (SOCKS5 ATYP=domain) rather than an IP, so your proxy does the final resolution.
  • Per-host request transforms still apply. Header injection and workload identity token resolution happen before the connection is dialed through your proxy.
  • The proxy hostname is re-resolved at dial time and the resolved address is pinned for that connection, so a DNS change cannot redirect a connection that is already being established.
  • Egress fails closed. If the proxy is unreachable, or the address does not speak SOCKS5, outbound connections from the sandbox fail instead of falling back to a direct connection. Make sure the proxy is reachable from the public internet before you point sandboxes at it.

Configuring a proxy

Pass network.egressProxy / network["egress_proxy"] when you create the sandbox:
You can combine it with the rest of the network configuration. Here all traffic is denied except api.example.com, and the traffic that is allowed goes through your proxy:

Fields

The proxy has to be reachable from E2B’s infrastructure. A hostname that does not resolve, or that resolves to a private or otherwise internal address range, is rejected at creation time, before the sandbox exists.

Updating a running sandbox

updateNetwork / update_network sets or replaces the proxy on a sandbox that is already running, with no restart:
The update replaces the whole configuration instead of merging into it, so omitting the proxy clears it. A network update that leaves the field out stops tunneling and sends the sandbox’s traffic out directly, even when the update was only meant to change the allow and deny lists. Repeat the proxy configuration in every update where you want to keep it.
An update that fails validation changes nothing, so the sandbox keeps tunneling through the proxy it already had.

Reading the current configuration

The sandbox info reports the active proxy under network:
The password is never returned.

Errors

An invalid proxy configuration is rejected when the sandbox is created, so a rejected create leaves nothing behind.

Self-hosted deployments

BYOP is available on E2B Cloud and in BYOC environments. Deployments built from the open source e2b-dev/infra repository cannot tunnel sandbox egress through a SOCKS5 proxy, and a sandbox that names one is rejected as unsupported by the orchestrator build.