browser_set_proxy
Configure proxy settings for the browser context after creation. Supports HTTP, HTTPS, SOCKS4, SOCKS5, and SOCKS5H proxies with optional authentication. Includes stealth features to prevent proxy detection.
Usage Example
Parameters
Required
context_idstringrequiredThe unique identifier of the browser context (e.g., 'ctx_000001')
typeenumhttphttpssocks4socks5+2 moreProxy protocol type: 'http' (HTTP proxy), 'https' (HTTPS proxy), 'socks4' (SOCKS4), 'socks5' (SOCKS5 with local DNS), 'socks5h' (SOCKS5 with remote DNS - most private), 'gae' (private app proxy)
hoststringrequiredProxy server hostname or IP address. Examples: '127.0.0.1', 'proxy.example.com', 'localhost'
portstringrequiredProxy server port number. Common ports: 8080 (HTTP), 3128 (Squid), 9050/9150 (Tor), 1080 (SOCKS)
Optional
usernamestringUsername for proxy authentication. Only required if the proxy server requires credentials
passwordstringPassword for proxy authentication. Only required if the proxy server requires credentials
stealthbooleanEnable stealth mode to prevent proxy/VPN detection. Blocks WebRTC leaks, DNS leaks, and other fingerprinting vectors. Default: true
block_webrtcbooleanBlock WebRTC to prevent real IP address leaking through STUN/TURN requests. Essential for privacy. Default: true (enabled when stealth mode is on)
spoof_timezonebooleanAutomatically spoof browser timezone to match proxy location (detected via IP geolocation). Default: false
spoof_languagebooleanAutomatically spoof browser language preferences to match proxy location. Default: false
timezone_overridestringManually set timezone instead of auto-detection. IANA format like 'America/New_York', 'Europe/London'. Takes precedence over spoof_timezone
language_overridestringManually set browser language instead of auto-detection. BCP47 format like 'en-US', 'de-DE'. Takes precedence over spoof_language
ca_cert_pathstringPath to custom CA certificate file (.pem, .crt, .cer) for SSL interception proxies. Required when using Charles Proxy, mitmproxy, or similar HTTPS inspection tools
ca_key_pathstringPath to CA private key file for GAE/private app proxy MITM. Required for generating per-domain certificates when using 'gae' proxy type
trust_custom_cabooleanTrust the custom CA certificate for SSL interception. Enable when using Charles Proxy, mitmproxy, or similar tools that intercept HTTPS traffic. Default: false
is_torbooleanExplicitly mark this proxy as a Tor connection. Enables circuit isolation so each context gets a unique exit node IP. Auto-detected if proxy is localhost:9050 or localhost:9150 with socks5/socks5h
tor_control_portstringTor control port for circuit isolation. Used to send SIGNAL NEWNYM to get a new exit node. Default: auto-detect (tries 9051 then 9151). Set to -1 to disable circuit isolation
tor_control_passwordstringPassword for Tor control port authentication. Leave empty to use cookie authentication (default) or no auth
Response
Returns a JSON object with the operation result.
{
"success": true,
"result": <value>
}