DocsProxy Managementbrowser_set_proxy

browser_set_proxy

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

1234567891011121314
import asyncio
from owl_browser import OwlBrowser, RemoteConfig
# Async usage
async with OwlBrowser(config) as browser:
context = await browser.create_context()
context_id = context["context_id"]
await browser.set_proxy(
context_id=context_id,
type="http",
host="value",
port="value"
)

Parameters

Required

context_idstringrequired

The unique identifier of the browser context (e.g., 'ctx_000001')

typeenum
httphttpssocks4socks5+2 more
required

Proxy 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)

hoststringrequired

Proxy server hostname or IP address. Examples: '127.0.0.1', 'proxy.example.com', 'localhost'

portstringrequired

Proxy server port number. Common ports: 8080 (HTTP), 3128 (Squid), 9050/9150 (Tor), 1080 (SOCKS)

Optional

usernamestring

Username for proxy authentication. Only required if the proxy server requires credentials

passwordstring

Password for proxy authentication. Only required if the proxy server requires credentials

stealthboolean

Enable stealth mode to prevent proxy/VPN detection. Blocks WebRTC leaks, DNS leaks, and other fingerprinting vectors. Default: true

block_webrtcboolean

Block WebRTC to prevent real IP address leaking through STUN/TURN requests. Essential for privacy. Default: true (enabled when stealth mode is on)

spoof_timezoneboolean

Automatically spoof browser timezone to match proxy location (detected via IP geolocation). Default: false

spoof_languageboolean

Automatically spoof browser language preferences to match proxy location. Default: false

timezone_overridestring

Manually set timezone instead of auto-detection. IANA format like 'America/New_York', 'Europe/London'. Takes precedence over spoof_timezone

language_overridestring

Manually set browser language instead of auto-detection. BCP47 format like 'en-US', 'de-DE'. Takes precedence over spoof_language

ca_cert_pathstring

Path 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_pathstring

Path to CA private key file for GAE/private app proxy MITM. Required for generating per-domain certificates when using 'gae' proxy type

trust_custom_caboolean

Trust the custom CA certificate for SSL interception. Enable when using Charles Proxy, mitmproxy, or similar tools that intercept HTTPS traffic. Default: false

is_torboolean

Explicitly 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_portstring

Tor 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_passwordstring

Password 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>
}