This feature is currently in public preview. During the preview, the proxy and network features are only available in the
us-was-1 region.Quick start
api.stripe.com normally — the proxy intercepts the request, injects the Authorization and Stripe-Version headers with the resolved secret, and forwards it. The sandbox never sees the raw API key.
How it works
When a sandbox is created with a proxy config, Blaxel:- Sets
HTTP_PROXY,HTTPS_PROXY, andNO_PROXYenvironment variables inside the sandbox - Installs a CA certificate and sets
NODE_EXTRA_CA_CERTSandSSL_CERT_FILEso TLS clients trust the proxy - Performs MITM on outbound HTTPS via CONNECT tunneling
- Matches each request against routing rules by destination domain
- Injects configured headers and body fields, resolving
{{SECRET:name}}placeholders server-side - Adds an
X-Blaxel-Request-Idheader to every proxied request for tracing
curl, wget, git, pip, npm, Node.js https, Python requests, etc.
Localhost (
127.0.0.1), private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), 169.254.169.254, .local, and .internal are always bypassed automatically.Configuration reference
All network settings are passed via thenetwork key in the sandbox creation options:
SandboxNetwork
| Field | Type | Description |
|---|---|---|
allowedDomains | string[] / list[str] | Allowlist — only these domains are reachable. Supports wildcards (*.s3.amazonaws.com). |
forbiddenDomains | string[] / list[str] | Denylist — all domains except these are reachable. Supports wildcards. If both are set, allowedDomains takes precedence. |
proxy | ProxyConfig | Proxy routing and bypass configuration. |
ProxyConfig
| Field | Type | Description |
|---|---|---|
routing | ProxyTarget[] / list[ProxyTarget] | Per-destination routing rules with header/body injection. |
bypass | string[] / list[str] | Domains added to NO_PROXY that skip the proxy entirely. Supports wildcards. |
ProxyTarget
| Field | Type | Description |
|---|---|---|
destinations | string[] / list[str] | Domain patterns this rule applies to. Use ["*"] for a global catch-all rule. Supports wildcards (*.example.com matches sub.example.com but not example.com). |
headers | Record<string, string> / dict | Headers injected into matching requests. Values may contain {{SECRET:name}} references. |
body | Record<string, string> / dict | JSON body fields injected into matching requests. Values may contain {{SECRET:name}} references. |
secrets | Record<string, string> / dict | Named secret values for this rule. Referenced via {{SECRET:name}} in headers and body. Write-only — never returned in API responses. Stored encrypted at rest. |
Proxy routing
Header injection with secrets
Body injection (POST requests)
Multiple routing rules
Global catch-all rule
["*"] destination matches all proxied traffic.
Proxy bypass
Domains listed inbypass skip the proxy tunnel entirely (direct connection):
Domain filtering (firewall)
Restrict which external domains the sandbox can reach, independent of proxy routing.Allowlist
Only the listed domains are reachable:Denylist
All domains except the listed ones are reachable:When both
allowedDomains and forbiddenDomains are set, allowedDomains takes precedence.Firewall + proxy combined
Firewall rules and proxy routing compose naturally:api.stripe.com and api.openai.com are reachable. The proxy injects credentials for Stripe requests; OpenAI requests go through unmodified.
Secret interpolation
Secrets are referenced in headers and body values using the{{SECRET:name}} syntax:
- Multiple
{{SECRET:...}}placeholders can appear in a single value - Secrets are resolved server-side by the proxy — the sandbox runtime never sees raw secret values
- Secrets are write-only: the
secretsfield is stripped from API responses - Secrets are scoped per routing rule: a secret defined on route A cannot be resolved by route B
- User code inside the sandbox can also send
{{SECRET:name}}in its own request headers or body — the proxy will resolve them if the secret exists on the matching route
Reading proxy config from an existing sandbox
After creation or retrieval, network config is available as typed model attributes:Full example: agent sandbox with proxy + firewall
Region availability
Proxy availability is region-dependent. TheRegion type includes a proxyAvailable boolean field. Check region support before relying on proxy features:
Environment variables set inside the sandbox
When proxy is configured, the sandbox automatically has:| Variable | Purpose |
|---|---|
HTTP_PROXY | Proxy URL for HTTP traffic |
HTTPS_PROXY | Proxy URL for HTTPS traffic |
NO_PROXY | Comma-separated bypass list (always includes localhost, private ranges) |
NODE_EXTRA_CA_CERTS | Path to CA cert for Node.js TLS verification |
SSL_CERT_FILE | Path to CA cert for other TLS clients (curl, Python, etc.) |
CLI tool compatibility
When proxy is enabled, the following tools work transparently inside the sandbox with no extra configuration:| Tool | Protocol | Notes |
|---|---|---|
curl | HTTPS | Automatic via HTTPS_PROXY env var |
git | HTTPS | May need GIT_SSL_CAINFO=$SSL_CERT_FILE for some operations |
pip / pip3 | HTTPS | Automatic |
npm / npx | HTTPS | Automatic |
Python requests | HTTPS | Automatic via env vars |
Node.js https | HTTPS | Automatic via HTTPS_PROXY + NODE_EXTRA_CA_CERTS env vars |
Behavior details
- Wildcard matching:
*.example.commatchessub.example.comanda.b.example.combut notexample.comitself - No cross-route leakage: Headers/secrets from one routing rule are never applied to requests matching a different rule
- User headers preserved: The proxy adds injected headers alongside any headers the sandbox code sends — it does not overwrite user-sent headers
- Body merge: Injected body fields are merged into the outbound JSON payload. User-sent fields take precedence if there’s a key collision
- Tracing: Every proxied request gets an
X-Blaxel-Request-Idheader for observability - Local traffic: Requests to
localhost/127.0.0.1are never routed through the proxy
