Skip to main content
All configuration is done through environment variables. Set these before starting the server:

Server configuration

Core server settings for port and deployment environment.
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.
When tab limits are reached, the server will recycle the oldest tab instead of rejecting requests. Monitor MAX_SESSIONS to prevent resource exhaustion.

Example: High-concurrency deployment

Timeouts

Fine-tune timeout values for different operations.
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.
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).
Cookie import is disabled by default. If CAMOFOX_API_KEY is not set, the /sessions/:userId/cookies endpoint returns 403. Generate a secure key with openssl rand -hex 32.

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 -e flags
  • Fly.io/Railway: fly secrets set or web dashboard

Example: Custom cookies directory

OpenClaw plugin configuration

When running as an OpenClaw plugin, the server subprocess inherits these variables from lib/config.js:
Set variables before starting OpenClaw:

Complete example

Production deployment with all variables:

Docker Compose example

Validation

The server validates configuration on startup and logs warnings for invalid values. Check logs for: