Configuration
All settings are environment variables. There are no config files.
Used by browserbay relay, and by browserbay start (where remote nodes are optional).
| Variable | Default | Meaning |
|---|---|---|
BROWSERBAY_API_KEY | none | An unrestricted key, at least 16 characters. openssl rand -base64 24 makes one. At least one of this and BROWSERBAY_API_KEYS is required. |
BROWSERBAY_API_KEYS | none | Keys for several services, each optionally confined to a namespace with a quota. See Several API keys. |
BROWSERBAY_ENROLLMENT_SECRETS | none | Comma-separated name:sha256 pairs, one per node or group of nodes allowed to join. Required for a standalone relay, optional for start. |
PORT | 8788 | Where the relay listens. |
BROWSERBAY_MAX_ACQUIRE_WAIT_MS | 60000 | The longest a client may wait for a free slot, 0 to 300000. |
BROWSERBAY_WEB_BOT_AUTH_KEY | none | The private Ed25519 key (a JWK, as JSON) whose public half the relay publishes at /.well-known/http-message-signatures-directory, for Web Bot Auth. browserbay web-bot-auth makes one. Empty means nothing is published. |
Used by browserbay node, and by the node inside browserbay start.
| Variable | Default | Meaning |
|---|---|---|
BROWSERBAY_RELAY_URL | none | Required. The relay’s address. A node refuses http:// unless the relay is on the same machine, because the enrollment secret travels to it. |
BROWSERBAY_ENROLLMENT_SECRET | none | Required, at least 16 characters. |
BROWSERBAY_ALLOW_INSECURE_RELAY | false | true lets the relay address be plain http:// or ws:// when it is on a private network: a private address (a private IP range, a single-label name such as relay, or a .svc, .internal or .local name). The enrollment secret then crosses that network without TLS, so use it only on one you trust, such as a cluster’s own network. A public address is still refused. A warning is logged on every start. Only the exact word true turns it on. |
BROWSERBAY_NODE_ID | the hostname | A name, unique per replica. A second node with the same name replaces the first. Letters, digits, _, ., -. |
BROWSERBAY_MAX_CONTEXTS | 5 | Concurrent slots on this node, 1 to 100. With BROWSERBAY_ISOLATION=process, concurrent Chromium processes: size it for that. |
BROWSERBAY_DRAIN_SECONDS | 120 | How long a stopping node waits for its slots after SIGTERM. 0 or more. Empty means the default. |
BROWSERBAY_ISOLATION | context | process starts a Chromium per slot instead of one shared by all. See Isolation. |
BROWSERBAY_NODE_LABELS | none | Comma-separated names for this node, such as residential,eu: letters, digits, _, ., -, at most 16. A slot that asks for nodeLabels is only placed on a node with all of them. See Avoid bot blocks. |
BROWSERBAY_NODE_EXCLUSIVE | false | true takes only the slots that ask for one of this node’s labels, so ordinary slots do not fill it. Needs BROWSERBAY_NODE_LABELS. |
BROWSERBAY_WEB_BOT_AUTH | off | optional signs the requests of the slots that ask (signRequests: true), always signs every slot’s, and a slot cannot ask to be left unsigned. Needs the next two. See Identify your box to sites. |
BROWSERBAY_WEB_BOT_AUTH_KEY | none | The private key, as above. The same one the relay publishes: a node signing with another is not given slots that ask to be signed. |
BROWSERBAY_WEB_BOT_AUTH_AGENT | none | Where the box says it is: the https address the relay is served at, as an origin with no path or trailing slash, such as https://browsers.example.com. |
BROWSERBAY_WEB_BOT_AUTH_FORMAT | legacy | How Signature-Agent is written. legacy is the quoted string Cloudflare’s verifier accepts. dictionary is the IETF draft’s (sig1="https://..."), which Cloudflare’s verifier rejected in October 2026. |
BROWSERBAY_WEB_BOT_AUTH_TTL_SECONDS | 60 | How long a signature is good for, 10 to 86400. Sites want it short. |
BROWSERBAY_CHROMIUM_SANDBOX | false | true keeps Chromium’s own sandbox on. It needs user namespaces. See Trust and isolation. |
BROWSERBAY_HEADLESS | true (the image: xvfb) | xvfb runs a headful browser on a virtual display the node starts: no HeadlessChrome in its user agent. It is the Docker image’s default, and it needs Xvfb (the image has it). true is headless, with about 150 MB less per node. false is headful on the display DISPLAY names. With BROWSERBAY_ISOLATION=process each slot gets a display of its own. See Avoid bot blocks. |
BROWSERBAY_WEBDRIVER_FLAG | hide | hide turns navigator.webdriver off, which driving a browser over DevTools turns on. keep leaves it on, for a browser that says what it is. |
BROWSERBAY_PROFILE_DIR | a fresh temp dir | Chromium’s profile. With BROWSERBAY_ISOLATION=process, the directory each slot’s profile is made in (<dir>/<slot id>, removed with the slot). |
BROWSERBAY_CHROMIUM_ENV_PASSTHROUGH | none | Comma-separated names of environment variables the browser should also see. Never passes BROWSERBAY_*. |
BROWSERBAY_CHROMIUM_EXECUTABLE | the image’s | A Chromium other than the one in the image. |
Several API keys
Section titled “Several API keys”One BROWSERBAY_API_KEY is an unrestricted key, which is all a single project needs. To share a box, give each project its own key in BROWSERBAY_API_KEYS, a comma-separated list of name:sha256[:namespace[:quota]] entries. The relay holds hashes, like the enrollment secrets. Make an entry with:
docker run --rm ghcr.io/degoke/browserbay key billing --namespace billing --quota 5It prints the key for the service (its client’s apiKey) and the entry for the relay. Both settings can be used together: BROWSERBAY_API_KEY is the key named default.
namespaceconfines the key. It can only create slots whose run id starts with<namespace>:(a client does this when it is made with the samenamespace; anything else is403), it only lists and releases such slots, and it cannot list nodes. A key without a namespace sees and releases everything: that is the operator’s key.quota(it needs a namespace) is the most slots the namespace may hold at once, counting browsers still being created. The next request is refused at once with429; it does not wait for a slot to free up.- Names, hashes and namespaces must each be unique across the entries.
- Slot tokens are unchanged: whoever holds a slot’s token can drive that slot, whatever key made it.
A key you already have
Section titled “A key you already have”browserbay key makes a key and its entry together. If the key already exists (a secret your service reads from its own settings, say), make the entry yourself. The relay wants the SHA-256 of the key as 64 hex characters, never the key:
printf %s "$KEY" | openssl dgst -sha256 | awk '{print $NF}'Use printf %s, not echo. echo adds a newline, which changes the hash, and then the key is never accepted: every request is 401.
Put the hash in an entry on the box, and give the service the same key and the same namespace:
# on the box: name:hash:namespace:quotaBROWSERBAY_API_KEYS=billing:<hash>:billing:5// on the servicecreateBrowserBay({ url, apiKey: process.env.BROWSERBAY_API_KEY, namespace: 'billing' })- The first field is a name for the key. The relay uses it in its logs, so it can be anything that is easy to recognise:
billing,billing-production. It may contain letters, digits,_,.and-. - The third field, the namespace, must be the word the service’s client is made with. The fourth, the quota, is optional, so
billing:<hash>:billingis a valid entry too. A quota needs a namespace. - The relay only holds the hash, so it cannot check how strong the key is. Make it at least 16 random characters:
openssl rand -base64 24makes one.
Isolation: a shared Chromium, or one per slot
Section titled “Isolation: a shared Chromium, or one per slot”BROWSERBAY_ISOLATION is a node setting (the all-in-one box takes it too).
context (default) | process | |
|---|---|---|
| Browser | one Chromium per node; each slot is a BrowserContext in it | one Chromium per slot, with its own profile directory |
| A hostile or runaway page | can take every slot on the node with it | takes only its own slot |
| Memory and start-up | light; a slot is ready at once | a few hundred MB per slot; about a second to start |
page.pdf(), tracing, browser.newContext() | refused | work |
| Ending a slot | its context is disposed | its Chromium is killed and its profile directory removed |
With process, a slot’s browser that crashes ends that slot only (its client is disconnected, slot.isAlive() turns false at once, and the node carries on), where with context a crash ends the node.
process does not change how a slot is held away from the machine: the client still cannot open file: or chrome: pages, read a file path into a page, or choose where a download goes, and the browser still starts with an allowlisted environment. A page that escapes Chromium’s renderer sandbox is also still inside the node’s container or VM, so BROWSERBAY_CHROMIUM_SANDBOX=true matters just as much in either mode. Two browser-wide calls become available that you may not want a client to have: SystemInfo tells it about the machine’s hardware, and browser.newContext({ proxy }) lets it point a context at a proxy of its choosing, though not one that reaches the node itself (loopback and link-local addresses are refused, however they are spelled), because that is where a slot’s own proxy forwarder and, in a box, the relay listen. A slot that was given a proxy keeps it for the contexts its client makes, unless the client names another.
Three secrets, three jobs
Section titled “Three secrets, three jobs”- The enrollment secret lets a node join. It goes between node and relay.
- The API key lets your services create, list and release browsers. It is never sent to a browser.
- The slot token reaches one slot’s browser. See Trust and isolation for what that means.
Make keys and secrets with the CLI: browserbay key and browserbay secret <name>.