Skip to main content
Every sandbox can be reached by a public URL, which lets you expose and connect to services running inside it. This page covers how to get that URL, connect to a server inside the sandbox, and customize the Host header services receive. To control the sandbox’s outbound internet access, see Internet access. To require authentication on the public URL, see Restricting public access.

Sandbox public URL

Every sandbox has a public URL that can be used to access running services inside the sandbox.
The code above will print something like this:
The first leftmost part of the host is the port number we passed to the method.

Connecting to a server running inside the sandbox

You can start a server inside the sandbox and connect to it using the approach above. In this example we will start a simple HTTP server that listens on port 3000 and responds with the content of the directory where the server is started.
This output will look like this:

Masking request host headers

You can customize the Host header that gets sent to services running inside the sandbox using the maskRequestHost / mask_request_host option. This is useful when your application expects a specific host format.
The ${PORT} variable in the mask will be automatically replaced with the actual port number of the requested service.

Connecting to HTTPS servers inside the sandbox

By default, the E2B proxy connects to the service inside the sandbox over plain HTTP. If the service listening on a port serves HTTPS (TLS) itself, list that port in the httpsPorts / https_ports option so the proxy connects to it over HTTPS instead. The public URL is HTTPS either way.
The certificate served by the sandbox is not verified, so self-signed certificates work. Ports not listed in httpsPorts / https_ports keep being proxied over plain HTTP.
This is not TLS passthrough. Requests to the public URL are still terminated at the E2B proxy and re-encrypted on the hop to the sandbox, so public access restrictions and request host masking apply to HTTPS ports as well.
The configured ports are returned in the network field of the sandbox info (getInfo() / get_info()), and cannot be changed after the sandbox is created.