How to Bypass JA4 TLS Fingerprinting in Python: curl_cffi vs tls-client Benchmarks

Almost every scraper developer hits the same wall eventually: you copy every header straight out of Chrome DevTools into Python requests or httpx, hit the URL, and get slapped with an instant 403 from Cloudflare or AWS WAF. Your headers look right, yet the request never even reaches the origin server.

The giveaway happens one layer lower during the unencrypted TLS handshake. Standard Python HTTP packages link against OpenSSL, whereas Chrome uses BoringSSL, producing a completely different JA4 signature. This playbook shows how to read JA4 hashes by eye, compare real Chrome 158 against four Python HTTP clients on tls.peet.ws, and ship reliable curl_cffi or tls-client sessions that pass TLS and HTTP/2 inspection.

Diagram breaking down Chrome 158 JA4 fingerprint compared to Python requests

Chrome 158's BoringSSL JA4 string next to Python requests' OpenSSL signature.

A 60-second cheat sheet for reading JA4 strings

Whenever a client initiates HTTPS, its plaintext ClientHello announces supported TLS versions, cipher suites, extensions, and ALPN protocols. Under the FoxIO JA4 standard, those fields compress into three segments separated by _ (a_b_c, 36 characters total).

Here is what real headless Chrome 158.0.8127.89 emitted against https://tls.peet.ws/api/all:

t13d1517h2_8daaf6152771_cb7bf5808d99

When troubleshooting a blocked script, look at the human-readable first block (t13d1517h2) before touching anything else:

  • t marks TLS over TCP (q signals QUIC / HTTP/3; d signals DTLS).
  • 13 means TLS 1.3.
  • d confirms a domain name was placed in SNI (i indicates a bare IP or missing SNI).
  • 15 and 17 count the non-GREASE cipher suites (15) and TLS extensions (17).
  • h2 captures the first and last letters of the top ALPN entry (h2 for HTTP/2 versus h1 for HTTP/1.1).

The last two blocks are 12-character truncated SHA-256 digests: JA4_b (8daaf6152771) hashes the cipher list after sorting it in hexadecimal order, while JA4_c (cb7bf5808d99) hashes sorted extensions (excluding SNI 0x0000 and ALPN 0x0010) combined with wire-order signature algorithms.

That sorting step explains why old JA3 randomization tricks stopped helping. Starting in Chrome 110 (early 2023), Chromium began shuffling TLS extension order on every handshake. Across three consecutive Chrome 158 launches on macOS, ja3_hash changed every time (f67731049e8d, cbc34cbfd9b7, 9c671720b420), while ja4 never budged from t13d1517h2_8daaf6152771_cb7bf5808d99. Both Cloudflare and AWS WAF now expose JA4 directly inside firewall rules and traffic scoring.

Live benchmark: Chrome 158 vs. four Python HTTP libraries

Tested on macOS (Python 3.15.2) against tls.peet.ws, here is how requests 2.34.2, httpx 0.29.0, curl_cffi 0.17.0, and tls-client 2.0.0 actually look on the wire:

Comparison chart of JA4, JA3, and Akamai HTTP/2 fingerprints across Python HTTP clients

Wire-level fingerprint output for requests, httpx, curl_cffi, and tls-client against real Chrome 158.

Client Wire protocol Matches Chrome JA4? Observed ja4 Akamai H2 prefix
Real Chrome 158.0.8127.89 h2 Baseline t13d1517h2_8daaf6152771_cb7bf5808d99 52d84b11737d
requests 2.34.2 HTTP/1.1 No (static JA3 48bdbfeea1fc) t13d1712h1_ab0a1bf427ad_581742d1f3c4 none
httpx 0.29.0 (default) HTTP/1.1 No (static JA3 72d7d4e38c1a) t13d1712h1_ab0a1bf427ad_e44827223d20 none
httpx 0.29.0 (http2=True) h2 No (ALPN puts http/1.1 first) t13d1712h1_ab0a1bf427ad_e44827223d20 29e6a0e9b360
curl_cffi (chrome / chrome152_macos) h2 Exact match (rotating JA3) t13d1517h2_8daaf6152771_cb7bf5808d99 52d84b11737d
curl_cffi (firefox155) h2 Matches Firefox profile t13d1517h2_8daaf6152771_3cbfd9057e0d 6ea73faa8fc5
curl_cffi (safari260) h2 Matches Safari profile t13d2014h2_a09f3c656075_d0a99439f9b1 c52879e43202
tls-client (chrome_152, shuffled ext) h2 Exact match (rotating JA3) t13d1517h2_8daaf6152771_cb7bf5808d99 52d84b11737d

Notice the trap with httpx(http2=True). Even though HTTP/2 succeeded (producing an OpenSSL/httpcore string of 1:4096;2:0;4:65535;5:16384;3:100;6:65536|16777216|0|m,a,s,p), its JA4 stayed stuck at t13d1712h1 because httpx advertises http/1.1 ahead of h2 in ALPN and still relies on OpenSSL ciphers.

Want to test your own machine? Install all four clients and run this compact harness:

pip install requests "httpx[http2]" curl_cffi tls-client
import httpx
import requests
import tls_client
from curl_cffi import requests as cffi_req

TARGET = "https://tls.peet.ws/api/all"


def report(tag: str, payload: dict) -> None:
    tls = payload["tls"]
    h2 = (payload.get("http2") or {}).get("akamai_fingerprint_hash") or "-"
    print(f"{tag:<24} {payload['http_version']:<9} {tls['ja4']}  h2={h2[:12]}")


report("requests", requests.get(TARGET, timeout=20).json())
with httpx.Client(http2=True, timeout=20) as hx:
    report("httpx h2", hx.get(TARGET).json())

for name in ("chrome", "chrome152_macos", "firefox155", "safari260"):
    report(f"curl_cffi:{name}", cffi_req.get(TARGET, impersonate=name, timeout=20).json())

utls_client = tls_client.Session(client_identifier="chrome_152", random_tls_extension_order=True)
utls_client.headers.update({
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36",
    "accept": "application/json,text/html;q=0.9,*/*;q=0.8",
    "accept-language": "en-US,en;q=0.9",
})
report("tls-client:chrome_152", utls_client.get(TARGET, timeout_seconds=20).json())

Production setup with curl_cffi (BoringSSL)

curl_cffi binds patched libcurl (curl-impersonate with BoringSSL and NSS) into Python. You can pass the moving alias impersonate="chrome" (which maps to Windows chrome152 in 0.17.0) so package upgrades track newer Chrome releases, or pin "chrome152" / "chrome152_macos" when you want deterministic builds.

Skip trying to hand-craft a Chrome fingerprint with ja3= and extra_fp=. Because JA4_b and JA4_c hash extensions and signature algorithms that JA3 omits, hand-tuned parameters rarely hit Chrome's full 17-extension handshake. Pin an official profile, verify it once at startup, and reuse a single AsyncSession so concurrent tasks share HTTP/2 multiplexing and TLS session resumption:

import asyncio
from curl_cffi import requests

CHROME_PROFILE = "chrome152"
CHROME_JA4 = "t13d1517h2_8daaf6152771_cb7bf5808d99"
TARGETS = [
    "https://httpbin.org/anything/item-1",
    "https://httpbin.org/anything/item-2",
    "https://httpbin.org/anything/item-3",
]


async def run_batch() -> None:
    gate = asyncio.Semaphore(3)
    async with requests.AsyncSession(impersonate=CHROME_PROFILE) as http:
        check = await http.get("https://tls.peet.ws/api/all", timeout=20)
        got_ja4 = check.json()["tls"]["ja4"]
        if got_ja4 != CHROME_JA4:
            raise RuntimeError(f"Unexpected JA4 for {CHROME_PROFILE}: {got_ja4}")

        async def grab(url: str):
            async with gate:
                resp = await http.get(url, timeout=20)
                return url, resp.status_code, len(resp.content)

        results = await asyncio.gather(*(grab(u) for u in TARGETS))
        for row in results:
            print(row)


asyncio.run(run_batch())

If your target serves HTTP/3, curl_cffi handles QUIC out of the box via http_version="v3" (verified returning HTTP 200 against https://cloudflare-quic.com/ with impersonate="chrome152").

When and how to configure tls-client (Go uTLS)

Go developers rely on uTLS for browser ClientHello emulation. In Python, tls-client exposes that Go HTTP stack through a compiled shared library wrapped with ctypes.

Comparison of curl_cffi BoringSSL architecture versus tls-client Go uTLS and default traps

Architectural differences and default gotchas between curl_cffi and tls-client.

Testing tls-client 2.0.0 exposed two silent footguns in its default settings:

  1. Bare default headers: if you skip passing explicit headers, tls-client transmits Chrome's genuine JA4 alongside User-Agent: tls-client/2.0.0 and only three headers (accept, accept-encoding, user-agent). Any WAF cross-checking UA against TLS drops it instantly.
  2. Frozen JA3 hashes: leaving random_tls_extension_order=False causes every request to repeat one static ja3_hash (2d25c56381929cc91bc97631a0a46f58). Flipping it to True restored normal Chrome-style JA3 rotation (15a508d912e4, 54e1042bca1b, e19cf07bf8c7).
Decision factor curl_cffi 0.17.0 tls-client 2.0.0
Default headers Injects 14 matching Chrome headers automatically Sends 3 headers with tls-client/2.0.0 UA until overridden
Concurrency model Native asyncio Thread-pool wrapper over Go CFFI calls
TLS engine curl-impersonate (BoringSSL / NSS) Compiled Go uTLS shared library
Extension shuffling Active by default on Chrome targets Requires random_tls_extension_order=True
HTTP/3 (QUIC) Supported via http_version="v3" Unavailable in Python bindings

Default to curl_cffi for almost any Python scraping project: native async scales cleanly and its headers stay in sync with its TLS profile. Choose tls-client only when matching an existing Go uTLS service or when you need a mobile/app profile unique to its catalog (such as okhttp4_android_13).

Why a matching JA4 still fails on tough targets

Clearing TLS inspection solves layer 1, yet four checks directly above it still flag automated traffic:

Four anti-bot checks beyond TLS JA4: HTTP/2, JA4 Signals, profile drift, and JS challenges

What WAFs evaluate after your ClientHello passes JA4 matching.

  • HTTP/2 settings and header order (JA4H): proxies expect Chrome's Akamai frame values (1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p) plus sec-ch-ua headers ordered ahead of user-agent. Replacing curl_cffi's header dict wholesale can scramble that sequence.
  • Aggregate network ratios: Cloudflare's JA4 Signals track hourly behavior per JA4 hash, such as browser_ratio_1h and cache_ratio_1h. Pulling pure HTML from a datacenter ASN without loading static assets stands out even with a genuine Chrome JA4.
  • Stale browser strings: FoxIO observes that browser JA4 values typically stay stable for roughly a year while User-Agent major numbers climb every few weeks. Rotate across a small set of current desktop profiles (chrome152, chrome152_macos, firefox155) and run a JA4 assertion in CI after dependency updates.
  • JavaScript challenges: HTTP clients never execute JS. Once a site enforces Turnstile, Canvas/WebGL checks, or navigator.userAgentData inspection, step up to real Chromium with Playwright and verify cross-layer consistency.

Deciding when to build vs. use managed social APIs

Building your own curl_cffi stack makes complete sense for niche e-commerce or directory targets. On heavily defended social platforms like TikTok or X, TLS parity is only step one before request signatures, session pacing, and residential IP scoring take over maintenance time.

When you would rather spend time analyzing data than babysitting fingerprints, managed Apify Actors handle the transport layer directly: Ultimate TikTok Scraper for profiles, hashtags, keywords, transcripts, and watermark-free clips; Advanced Search TikTok API for country- and date-filtered searches with live HTTP Standby mode; and Advanced X.com Twitter API for tweets, searches, and reply threads without official X API keys.

Benchmark managed social scraping against DIY maintenance

Every new Apify account includes $5 of monthly usage to test TikTok and X extraction before scaling.

Get Started Free on Apify

Further reading

  1. FoxIO JA4+ specification repository and JA4.md technical notes
  2. Cloudflare engineering post on JA4 Signals
  3. AWS WAF documentation for JA4 rule matching
  4. curl_cffi, tls-client, and refraction-networking/utls

Comments