PSA Intelligence Impersonate Proxy¶
HTTP/HTTPS proxy that impersonates browser TLS fingerprints using curl_cffi that can be effective in avoiding blocks against non-browser clients.
Attribution
This project started as a fork of hauxir/tls-impersonate-proxy and has now evolved beyond a pull request to merge. This impersonate-proxy project is maintained at psaintelligence/impersonate-proxy.
Pypi: pypi.org/project/impersonate-proxy
GHCR: github.com/psaintelligence/impersonate-proxy/pkgs/container
Quick Start (Docker)¶
Spin up the proxy container:
docker run --rm -p 8899:8899 \
-v /tmp/impersonate-certs:/home/impersonate/.config/impersonate-proxy \
ghcr.io/psaintelligence/impersonate-proxy:latest
Once started, configure your client to trust the CA and use the proxy:
# Export the generated CA cert to trust the proxy
export SSL_CERT_FILE=/tmp/impersonate-certs/ca.crt
# Issue request through the proxy
curl --silent -x http://127.0.0.1:8899 https://tls.browserleaks.com/json
Quick Start (pip / uv)¶
Install and start the proxy locally:
# Install via pipx from pypi
pipx install impersonate-proxy
# Or install via uv from source
uv pip install git+https://github.com/psaintelligence/impersonate-proxy.git
# Start the proxy (default: 127.0.0.1:8899)
impersonate-proxy
Features¶
- TLS Impersonation: Disguises client TLS fingerprints as standard browsers (Chrome or Firefox via
curl_cffi >= 0.17.0). - Header Adapter & Delegation: Strips conflicting non-browser client headers (e.g.
User-Agent: python-httpxand the fullSec-CH-UA-*family) so nativecurl-impersonateprofile defaults shine through, while preserving payload, auth, and multi-cookie semantics. - Realistic Fingerprinting: Injects a platform-coherent full-build User-Agent with the complete
Sec-CH-UAfamily, authentic Chromium GREASE brand lists, and canonical HTTP/2 header order for Chrome targets — and a UA-only full-build User-Agent for Firefox targets — on top of curl_cffi's TLS impersonation (on by default,--no-fingerprint-realto disable). - Access Control & SSRF Guardrails: Optional Basic proxy authentication (
--proxy-auth), client allowlist (--allow-from), target deny list (--block-host), MITM-bypass raw-tunnel list (--raw-tunnel-host), and private-network egress blocking (--block-private-ips), with@/path/to/filelists andSIGHUPlive reload. - Connection Keep-Alive,
CurlShare& Custom DNS: Pools statelesscurl_cffisessions (discard_cookies=True,trust_env=False) backed by a shared DNS + TLS session cache (CurlShare), optional custom DNS / DoH (--dns),--max-threadshandler cap, structured JSON logging (--log-format json), local/healthzliveness probe, and Prometheus/metrics(--stats-port) with latency histograms and active-thread gauges. - Fast Dynamic Cert Generation: Dynamic certificate generation using fast Elliptic Curve (ECDSA P-256) cryptography with leaf key reuse and an expiring LRU SSLContext cache.
Capabilities¶
| Capability | What it does | Benefit |
|---|---|---|
| TLS Fingerprinting | Matches JA3/JA4/HTTP2 fingerprints with real browsers | Defeats Cloudflare, Akamai, and Imperva WAF blocks |
| MITM CONNECT Decryption | Decrypts and re-signs HTTPS traffic using local CA (with --raw-tunnel-host bypass) | Allows inspection, header filtering, and proxying of TLS streams while supporting pinned/WebSocket hosts |
| Header Delegation | Strips non-browser headers and delegates to curl-impersonate | Ensures User-Agent and TLS fingerprint profiles align natively without duplication |
| Client-Hint Coherence | Full-build UA + complete Sec-CH-UA family with authentic GREASE in canonical HTTP/2 header order (Chrome); UA-only curation for Firefox | Removes the scrubbed-UA / partial-client-hint tells that fingerprint services flag |
| Access Control & SSRF Guardrails | Optional --proxy-auth, --allow-from, --block-host, --block-private-ips, and SIGHUP file reload | Runs the proxy as a controlled, multi-user-safe egress point |
Session Pooling & CurlShare | Stateless pooled curl_cffi sessions with shared DNS + TLS session resumption and optional --dns / DoH | Boosts throughput without cross-client cookie leakage or proxy env loops |
| P-256 Cryptography | Reuses a static leaf private key with a true LRU + pre-expiry cert cache | Keeps leaf cert issuance <1ms and avoids serving expired certs in long-lived containers |
| Observability & Limits | Prometheus /metrics (counters, active threads, latency histogram), --log-format json, local /healthz, and --max-threads | Monitors traffic live, integrates with log/container tooling, and prevents resource exhaustion |
Guided Tour¶
- Installation Guide: System setup, CLI parameters, and Docker integrations.
- How It Works: Deep dive into the interception pipeline, session pool, and header delegation mechanism.
