Environment variables
Set these environment variables before starting the Camofox server:Configuration
Local development
Docker deployment
Fly.io deployment
Railway deployment
In the Railway dashboard:- Go to your service → Variables
- Add:
PROXY_HOST=166.88.179.132PROXY_PORT=46040PROXY_USERNAME=myuserPROXY_PASSWORD=mypass
- Redeploy
How GeoIP works
When proxy configuration is detected, Camofox’s GeoIP feature automatically:- Resolves the proxy’s exit IP address via geo-lookup
- Sets browser locale to match the IP’s country (e.g.,
en-GBfor UK,de-DEfor Germany) - Sets timezone to match the IP’s region (e.g.,
Europe/London,America/New_York) - Sets geolocation coordinates to match the IP’s city (latitude/longitude)
- Configures Camoufox fingerprint to align with the derived locale
Without proxy
If no proxy is configured, Camofox uses default US-based fingerprinting:- Locale:
en-US - Timezone:
America/Los_Angeles - Geolocation: San Francisco, CA coordinates (37.7749, -122.4194)
Fingerprint consistency
GeoIP ensures that all geolocation signals exposed to websites are consistent:
This prevents geolocation mismatches that can trigger bot detection. For example, if your proxy exits in Germany but your browser claims to be in California, sites may flag the session as suspicious.
Proxy protocol
Camofox uses HTTP CONNECT tunneling (server.js:286-298):
- HTTP proxies with CONNECT tunneling
- SOCKS5 proxies (if your proxy supports it)
- Basic authentication via username/password
Implementation details
Proxy config resolution
ThebuildProxyConfig() function (server.js:285-299) checks for proxy environment variables at startup:
PROXY_HOST or PROXY_PORT is missing, proxy is disabled.
Browser launch with GeoIP
When launching the browser (server.js:379-396), the proxy config is passed to Camoufox’s launchOptions():
geoip: !!proxy flag tells Camoufox to perform geo-lookup and configure fingerprinting.
Context creation without overrides
When creating browser contexts for sessions (server.js:432-443), the code checks if a proxy is configured:
Residential proxies
For best results, use residential proxies instead of datacenter proxies. Residential IPs are less likely to be flagged by anti-bot systems. Recommended providers:- Bright Data - Residential/mobile proxies
- Smartproxy - Residential proxies
- Oxylabs - Datacenter and residential proxies
Proxy rotation
Camofox does not rotate proxies automatically. Each browser instance uses a single proxy configuration for its entire lifetime. For proxy rotation:- Restart the browser with a new proxy config (not recommended - slow)
- Deploy multiple Camofox instances with different proxy configs behind a load balancer
- Use rotating proxies from your provider (proxy endpoint rotates IPs per request)
Debugging proxy issues
Connection failures
Symptoms: Browser fails to launch, all page loads timeout Causes:- Proxy host/port unreachable
- Firewall blocking outbound connections
- Proxy authentication failed
GeoIP mismatch
Symptoms: Browser locale/timezone don’t match proxy location Causes:- GeoIP database out of date
- Proxy IP is newly allocated and not in geo databases
- Context options override GeoIP settings
locale, timezoneId, or geolocation in the context options when using GeoIP.
Slow page loads
Causes:- High latency proxy
- Proxy bandwidth throttling
NAVIGATE_TIMEOUT_MS (default 30s).
Logging
Camofox logs proxy status at startup:geoip: true, GeoIP is active.