Skip to content

Configuration

All settings are environment variables. There are no config files.

Used by browserbay relay, and by browserbay start (where remote nodes are optional).

VariableDefaultMeaning
BROWSERBAY_API_KEYnoneAn 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_KEYSnoneKeys for several services, each optionally confined to a namespace with a quota. See Several API keys.
BROWSERBAY_ENROLLMENT_SECRETSnoneComma-separated name:sha256 pairs, one per node or group of nodes allowed to join. Required for a standalone relay, optional for start.
PORT8788Where the relay listens.
BROWSERBAY_MAX_ACQUIRE_WAIT_MS60000The longest a client may wait for a free slot, 0 to 300000.
BROWSERBAY_WEB_BOT_AUTH_KEYnoneThe 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.

VariableDefaultMeaning
BROWSERBAY_RELAY_URLnoneRequired. 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_SECRETnoneRequired, at least 16 characters.
BROWSERBAY_ALLOW_INSECURE_RELAYfalsetrue 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_IDthe hostnameA name, unique per replica. A second node with the same name replaces the first. Letters, digits, _, ., -.
BROWSERBAY_MAX_CONTEXTS5Concurrent slots on this node, 1 to 100. With BROWSERBAY_ISOLATION=process, concurrent Chromium processes: size it for that.
BROWSERBAY_DRAIN_SECONDS120How long a stopping node waits for its slots after SIGTERM. 0 or more. Empty means the default.
BROWSERBAY_ISOLATIONcontextprocess starts a Chromium per slot instead of one shared by all. See Isolation.
BROWSERBAY_NODE_LABELSnoneComma-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_EXCLUSIVEfalsetrue 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_AUTHoffoptional 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_KEYnoneThe 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_AGENTnoneWhere 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_FORMATlegacyHow 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_SECONDS60How long a signature is good for, 10 to 86400. Sites want it short.
BROWSERBAY_CHROMIUM_SANDBOXfalsetrue keeps Chromium’s own sandbox on. It needs user namespaces. See Trust and isolation.
BROWSERBAY_HEADLESStrue (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_FLAGhidehide 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_DIRa fresh temp dirChromium’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_PASSTHROUGHnoneComma-separated names of environment variables the browser should also see. Never passes BROWSERBAY_*.
BROWSERBAY_CHROMIUM_EXECUTABLEthe image’sA Chromium other than the one in the image.

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:

Terminal window
docker run --rm ghcr.io/degoke/browserbay key billing --namespace billing --quota 5

It 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.

  • namespace confines the key. It can only create slots whose run id starts with <namespace>: (a client does this when it is made with the same namespace; anything else is 403), 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 with 429; 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.

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:

Terminal window
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:

Terminal window
# on the box: name:hash:namespace:quota
BROWSERBAY_API_KEYS=billing:<hash>:billing:5
// on the service
createBrowserBay({ 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>:billing is 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 24 makes 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
Browserone Chromium per node; each slot is a BrowserContext in itone Chromium per slot, with its own profile directory
A hostile or runaway pagecan take every slot on the node with ittakes only its own slot
Memory and start-uplight; a slot is ready at oncea few hundred MB per slot; about a second to start
page.pdf(), tracing, browser.newContext()refusedwork
Ending a slotits context is disposedits 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.

  • 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>.