All configuration is done through environment variables. Set these before starting the server:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jo-inc/camofox-browser/llms.txt
Use this file to discover all available pages before exploring further.
Server configuration
Core server settings for port and deployment environment.| Variable | Description | Type | Default |
|---|---|---|---|
CAMOFOX_PORT | HTTP server port | Integer | 9377 |
PORT | Fallback port (used if CAMOFOX_PORT not set) | Integer | 9377 |
NODE_ENV | Node.js environment mode | String | development |
In production mode (
NODE_ENV=production), detailed error messages are hidden and only logged server-side.Example: Custom port
Resource limits
Control concurrent sessions, tabs, and memory usage.| Variable | Description | Type | Default |
|---|---|---|---|
MAX_SESSIONS | Maximum concurrent browser sessions (users) | Integer | 50 |
MAX_TABS_PER_SESSION | Maximum tabs per user session | Integer | 10 |
MAX_TABS_GLOBAL | Global tab limit across all sessions | Integer | 10 |
MAX_CONCURRENT_PER_USER | Concurrent API requests per user | Integer | 3 |
MAX_OLD_SPACE_SIZE | Node.js V8 heap limit in MB | Integer | 128 |
Example: High-concurrency deployment
Timeouts
Fine-tune timeout values for different operations.| Variable | Description | Type | Default |
|---|---|---|---|
SESSION_TIMEOUT_MS | Session inactivity timeout (ms) | Integer | 1800000 (30 min) |
BROWSER_IDLE_TIMEOUT_MS | Kill browser when idle with no sessions (ms, 0=never) | Integer | 300000 (5 min) |
HANDLER_TIMEOUT_MS | Maximum time for any API handler (ms) | Integer | 30000 (30 sec) |
NAVIGATE_TIMEOUT_MS | Page navigation timeout (ms) | Integer | 25000 (25 sec) |
BUILDREFS_TIMEOUT_MS | Element ref building timeout (ms) | Integer | 12000 (12 sec) |
The browser launches lazily on first request and shuts down after
BROWSER_IDLE_TIMEOUT_MS with no active sessions. This keeps memory at ~40MB when idle.Example: Faster timeouts for speed
Example: Disable idle shutdown
Proxy configuration
Route all browser traffic through a proxy with automatic GeoIP detection.| Variable | Description | Type | Default |
|---|---|---|---|
PROXY_HOST | Proxy hostname or IP address | String | - |
PROXY_PORT | Proxy port | Integer | - |
PROXY_USERNAME | Proxy authentication username | String | - |
PROXY_PASSWORD | Proxy authentication password | String | - |
When a proxy is configured, Camoufox’s built-in GeoIP automatically sets browser
locale, timezone, and geolocation to match the proxy’s exit IP. This ensures the browser fingerprint is consistent with the proxy location.Example: Residential proxy
Docker proxy configuration
Security
API keys for protected endpoints (cookie import and server shutdown).| Variable | Description | Type | Default |
|---|---|---|---|
CAMOFOX_API_KEY | Enable cookie import endpoint (disabled if unset) | String | - |
CAMOFOX_ADMIN_KEY | Required for POST /stop endpoint | String | - |
CAMOFOX_COOKIES_DIR | Directory for cookie files | Path | ~/.camofox/cookies |
Example: Enable cookie import
Why environment variables?
API keys are secrets and should never be stored in plaintext config files (openclaw.json, config.json, etc.). Instead:
- Set in shell profile (
.bashrc,.zshrc) - Use systemd unit files (
Environment=CAMOFOX_API_KEY=...) - Docker/Compose:
env_file:or-eflags - Fly.io/Railway:
fly secrets setor web dashboard
Example: Custom cookies directory
OpenClaw plugin configuration
When running as an OpenClaw plugin, the server subprocess inherits these variables fromlib/config.js: