In short.
This E2B documentation page teaches developers how to serve E2B Sandbox URLs under their own domain. The main catch is that you have to provision, operate and secure a proxy server yourself. The page does not say what that costs or which charges apply. The guide sets up a Google Cloud VM running Caddy in Docker, uses a Cloudflare API token for DNS-based certificate issuance, and adds a wildcard Caddyfile that forwards requests such as 8080-sandboxid.mydomain.com to 8080-sandboxid.e2b.app. You then add a wildcard A record in Cloudflare and test with an nginx server inside a Sandbox. The page gives no costs, licence, security hardening, scaling or monitoring guidance. Nothing in it was executed for this report, so everything described here is what the page says, not what was observed.
Researched and written by an AI model and checked by a second AI model. How it works
This report covers the complete selected documentation page at [https://docs.e2b.dev/network/custom-domain.md], as captured in selected-page.txt. Linked pages are excluded, including the E2B CLI page at [https://docs.e2b.dev/cli.md] and the documentation index at [https://docs.e2b.dev/llms.txt]. The page contains no licence or reuse/distribution terms. Nothing was executed: the VM creation, Docker build, Caddy configuration, Cloudflare DNS record and nginx test were not run, so their behaviour, costs and current validity are untested or unknown.
The overview
Identity
This resource is the E2B documentation page titled Custom domain, at [https://docs.e2b.dev/network/custom-domain.md]. Its stated purpose is to show how to set up a custom domain for Sandboxes hosted on E2B. It is a written how-to guide with shell commands and configuration files. It is not a software package, library or hosted product.
The page describes one specific architecture: a Google Cloud Platform virtual machine running a Caddy web server in Docker, using Cloudflare DNS, that proxies requests to the Sandboxes. Its own example maps 8080-sandboxid.mydomain.com to 8080-sandboxid.e2b.app.
The page does not name an author, a version number or a publication date.
Assessment
Judged from the page alone, it is a concrete and fairly complete walkthrough for one particular setup. It includes the VM creation command, Docker installation, a Dockerfile, a Docker Compose file, a Caddyfile, an environment file, a DNS record and a test procedure. A reader comfortable with GCP, Docker and Cloudflare can follow it from start to finish.
It is a minimal reference setup, not a production design. It says nothing about access control at the proxy, firewall rules, static IP addresses, high availability, log retention, monitoring, upgrades or cost. Those gaps are the main things a reader has to fill in.
Nothing was executed for this assessment. Because the configuration was not run, this report cannot say whether it works as written on current GCP, Cloudflare, Caddy or E2B services.
Who it is for
The guide is for developers or platform operators who use E2B Sandboxes and want sandbox URLs to appear under a domain they control instead of e2b.app. The page's example URLs start with a port plus the sandbox ID, such as 80-sandboxid.
It assumes working knowledge of the command line, Google Cloud (gcloud, VMs, SSH), Docker and Docker Compose, DNS records and Cloudflare. A beginner could follow the commands, but would need to understand TLS certificates, DNS propagation and basic server security to run this safely.
The page does not say who in an organisation should do this, or whether it is meant for individual developers, teams or production services.
Capabilities
If the steps work as described, requests for hostnames in the documented pattern, such as 8080-sandboxid.mydomain.com, reach your own server and are forwarded over HTTPS to the matching e2b.app host, such as 8080-sandboxid.e2b.app. The page's test expects [https://80-sandboxid.mydomain.com] to show the default nginx welcome page from a Sandbox. The Caddyfile's label index fits the two-label base domain in the example (mydomain.com). Support for other hostname depths or domain structures is unverified.
The Caddyfile is configured for the wildcard site *.mydomain.com and uses the Cloudflare DNS challenge to get a certificate, so TLS ends at your proxy. It passes the original client details to the upstream in the X-Real-IP, X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host headers. It also sets the Host header and the TLS server name to the e2b.app host.
The Docker Compose file also opens UDP port 443, marked as optional for HTTP/3, and the Caddyfile includes an optional JSON access log. The page does not claim any other features, such as authentication, caching, rate limiting or load balancing.
Using it
Requirements
The page lists two prerequisites: a domain name registered and configured with Cloudflare DNS, and a Cloudflare API token that can manage DNS records.
Other requirements are implied by the steps but not listed as prerequisites. The commands use a Google Cloud project (shown as the placeholder your-project-id) and the gcloud command-line tool. The test step uses the E2B CLI to create a Sandbox. The commands also suggest you need permission to create and SSH into Compute Engine VMs, but the page does not say so. The page does not say whether an E2B account is needed, so that is unverified. The VM described is a Debian 12 machine of type n2-standard-2 in zone us-west1-a with a 20 GB boot disk, IP forwarding enabled, and the network tags http-server and https-server.
Docker is installed on the VM with the install script from [https://get.docker.com]. The Dockerfile uses the caddy:builder and caddy:latest images and builds Caddy with the github.com/caddy-dns/cloudflare module. These steps download software, so the VM will likely need outbound network access while installing and building. The page does not list the endpoints involved, so the exact network requirements are unverified. It gives no minimum versions, and the images and plugin are not pinned.
How it works
A browser requests a hostname in the documented pattern, such as 8080-sandboxid.mydomain.com. A wildcard A record in Cloudflare, shown as *.mydomain.com, points such hostnames to the VM's IP address, so the request reaches the Caddy container on ports 80 and 443.
Caddy runs a build that includes the Cloudflare plugin. It proves domain ownership through the DNS challenge, using the CLOUDFLARE_API_TOKEN environment variable, to get a certificate for the *.mydomain.com site. The Caddyfile then stores the host label at index 2 in a variable called sandboxId. The page's comment explains that labels are counted from the right. For abc123.mydomain.com, label 0 is com, label 1 is mydomain and label 2 is abc123.
Caddy then reverse-proxies to that label plus .e2b.app on port 443. It sets the Host header and the TLS server name to the same e2b.app name and uses HTTPS to the upstream. The variable is called sandboxId, but in the page's example it holds the whole first label, including the port prefix (for example 8080-sandboxid). Because labels are counted from the right, index 2 fits the two-label base domain in the example, mydomain.com. The page does not discuss deeper hostnames, other domain structures or how to change the index, so support for them is unverified.
Setup
The page splits setup into four parts. First, GCP VM setup: run gcloud compute instances create to make the e2b-custom-domain-proxy VM, then connect with gcloud compute ssh. Second, server setup: install Docker with the script from [https://get.docker.com], create a Dockerfile, a docker-compose.yml, a Caddyfile and a .env file holding the Cloudflare token, then run docker compose build and docker compose up -d.
Third, domain setup: in the Cloudflare dashboard, create a wildcard A record, shown as *.mydomain.com A GCP_VM_IP, pointing to the VM's IP address. The page notes that DNS can take a few minutes to propagate and the certificate a few minutes to be issued. It also says any existing AAAA (IPv6) records for the domain must be removed or updated to point at the VM.
Fourth, testing: create a Sandbox with e2b sandbox create base, install and start nginx inside it, and open [https://80-sandboxid.mydomain.com] in a browser. You should see the default nginx welcome page.
The page leaves several points open. It does not say how firewall rules for ports 80 and 443 are provided; it only applies the http-server and https-server network tags. It does not say whether to reserve a static IP so the DNS record stays valid after VM restarts, or whether the Cloudflare record should be DNS-only or proxied. It also does not explain how the nginx commands are run inside the Sandbox shell.
Worked example
The page's own example maps 8080-sandboxid.mydomain.com to 8080-sandboxid.e2b.app. The Caddyfile starts with *.mydomain.com, which you replace with your own wildcard domain.
The built-in test creates a Sandbox from the base template with e2b sandbox create base, then runs sudo apt install nginx and sudo systemctl start nginx inside it. nginx serves on port 80 by default, so the page expects [https://80-sandboxid.mydomain.com] to show the nginx welcome page, with sandboxid replaced by the real Sandbox ID.
This example was not run for this report. The expected result is what the page says should happen, not an observed outcome.
Assessment & evidence
Limitations and risks
Security and operations are mostly left to the reader. The page stores the Cloudflare API token in a plain .env file and passes it into the container as an environment variable. It does not discuss limiting the token's scope, protecting the VM, restricting who can use the proxy, or rate limiting. Docker is installed by downloading the script from [https://get.docker.com] and piping it straight into sudo sh. That carries the usual trust risk of running a remote script with root privileges.
Builds may not be reproducible, because the Dockerfile uses caddy:builder, caddy:latest and an unpinned Cloudflare plugin, so a later build may differ from an earlier one. The Caddyfile writes access logs to /var/log/caddy/access.log, but the Compose file mounts no volume for that path, and the page does not say whether those logs persist or how they are collected.
The setup is one VM running one container, with no failover described, so it is a single point of failure for all custom-domain traffic. The index in {labels.2} fits two-label base domains, and the page gives no guidance for others. The page does not say whether WebSockets or long-lived connections work through the proxy. It also describes no E2B-side configuration beyond the e2b.app hostnames used here.
Because nothing was executed, there is no evidence on whether the commands and configuration work today.
Reasoning
The page is a practical, self-contained guide. Each part shows exact commands or file contents, and the Caddyfile has comments explaining how the label indexing works. That level of detail makes it possible to write a useful report for people considering this setup.
The architecture looks plausible from the configuration shown. The Caddyfile uses a Cloudflare DNS challenge for the wildcard site *.mydomain.com. The wildcard DNS record points hostnames in the documented pattern, such as 8080-sandboxid.mydomain.com, to one host. The reverse_proxy block sets the Host header and TLS server name to the e2b.app name, which should let the upstream route to the right Sandbox. The label index fits the two-label base domain in the example; other hostname depths or domain structures are unverified. These conclusions come from reading the configuration, not from running it.
The risks listed above follow from what the page leaves out, such as firewall rules, a static IP, access control, version pinning and log persistence. They are gaps in the documentation, not failures anyone has shown.
Alternatives
The simplest alternative visible on the page is not using a custom domain at all: the default Sandbox URLs are on the e2b.app domain, as in 8080-sandboxid.e2b.app.
The page does not compare other options and documents no other reverse proxies or hosting arrangements, such as running the proxy somewhere other than a GCP VM. The configuration does more than get a wildcard certificate and rewrite the Host header. It also pulls the sandbox label out of the hostname, connects to the upstream over HTTPS and sets the TLS server name. Whether other proxies or hosts are compatible, and what configuration they would need, is unknown. The captured page does not say whether E2B offers a managed custom-domain feature.
Evidence
Everything in this report comes from one captured file, selected-page.txt, which holds the text of [https://docs.e2b.dev/network/custom-domain.md] (5,686 bytes, captured 2026-11-15). It contains the page's prose, notes, commands, Dockerfile, Docker Compose file, Caddyfile, .env example, DNS record example and test steps.
The page also has a notice pointing to the documentation index at [https://docs.e2b.dev/llms.txt] and a link to the E2B CLI page at [https://docs.e2b.dev/cli.md]. Those pages were not part of the evidence and were not read.
No run logs, test output, benchmarks or third-party reviews were available.
Access & freshness
Costs
The page states no prices, so whether charges apply and how large they are is unknown. Following it involves provisioning and operating a Google Cloud VM (n2-standard-2 with a 20 GB boot disk) and using a registered domain, a Cloudflare account and E2B Sandboxes. The page does not give the cost of any of these, or say whether a particular Cloudflare plan is needed for the DNS and API token features it uses.
The Compose file's restart: unless-stopped setting only controls when the Caddy container restarts. It does not decide how long the VM runs or how long it is billed, and the page says nothing about VM uptime.
The page does not say whether network egress, an external IP address or log storage on GCP add charges, so these are unknown. Caddy, Docker and the Cloudflare DNS plugin are downloaded as images and modules, and the page does not describe their licences or prices.
Rights and licence
The captured page has no licence statement or reuse terms for the documentation text or the code snippets. This evidence does not establish whether the snippets may be copied, adapted or redistributed.
The page tells you to download third-party software (Docker, the Caddy images, the caddy-dns/cloudflare plugin and Debian), each with its own terms, which are not described here. Using E2B Sandboxes is subject to E2B's own service terms, which this page does not cover.
Freshness
The page was captured on 2026-11-15. It shows no publication or last-updated date and no version numbers for Docker, Caddy, the Cloudflare plugin or the E2B CLI, so how recently the instructions were checked is unknown.
The commands use the debian-12 image family and floating latest tags, so behaviour may change as those images and the GCP, Cloudflare and E2B services change. The page itself may also have changed since capture.
Suggested actions
If you need your own domain for E2B Sandbox URLs, treat this page as a starting recipe. Before running it, estimate the monthly cost of the VM, IP address and egress, and check the current E2B documentation for any newer or managed option.
When adapting it, verify the required API permissions and restrict the token to the relevant domain. Keep the .env file out of version control, pin the Caddy and plugin versions, make sure your GCP firewall allows only the ports you need, and reserve a static IP before creating the DNS record. If your base domain is not a two-label name, check the label index, and add log persistence if you need the logs.
After setup, run the nginx test from the page, and add whatever authentication or rate limiting your use case needs. These suggestions go beyond the page, which does not cover them.
