Developer Recipes

Replaying cf_clearance & Turnstile Tokens

Obtaining a valid Cloudflare clearance cookie is only half the battle. To successfully replay it against protected origin servers, your client must satisfy the three-way cryptographic binding: the same exit IP, the exact User-Agent, and an authentic Chrome TLS fingerprint.

Notice:Examples — verify against your library version. Network libraries frequently update TLS cipher defaults and proxy authentication hooks. Test recipes against your target origin before high-volume deployment.
1. Same Exit IP

The proxy you dispatch to AntiCloudflareTask must be the exact same exit proxy IP used when making downstream requests.

2. Matching User-Agent

You must pass the exact solution.userAgent string returned by floweno. Mismatched browser versions are rejected.

3. Chrome TLS Fingerprint

Cloudflare validates the JA3/JA4 TLS ClientHello fingerprint and HTTP/2 settings. Python requests is rejected; use curl_cffi or real browsers.

Python (curl_cffi)

Recommended HTTP client for replaying cf_clearance cookies with exact Chrome TLS fingerprint matching.

from curl_cffi import requests

# Prerequisites:
# 1. Same exit IP (same proxy that solved the task)
# 2. Exact user-agent returned in the solve solution
# 3. impersonate="chrome" to match Chrome JA3/JA4 TLS handshake & HTTP/2 frames

PROXY = "http://user:pwd@203.0.113.10:8080"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36"
CF_CLEARANCE = "abC123XyZ_clearance_cookie_value..."

session = requests.Session()

# Set cookie for the target domain
session.cookies.set(
    name="cf_clearance",
    value=CF_CLEARANCE,
    domain="example.com"
)

headers = {
    "User-Agent": USER_AGENT,
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
    "Accept-Language": "en-US,en;q=0.9",
    "Sec-Ch-Ua": '"Chromium";v="151", "Google Chrome";v="151", "Not-A.Brand";v="99"',
    "Sec-Ch-Ua-Mobile": "?0",
    "Sec-Ch-Ua-Platform": '"Windows"',
}

# Critical: impersonate="chrome" mirrors the TLS client hello and cipher suites
response = session.get(
    "https://example.com/protected-page",
    headers=headers,
    proxies={"http": PROXY, "https": PROXY},
    # Use the curl_cffi Chrome target closest to solution.binding.chrome_major
    impersonate="chrome"
)

print(f"Status Code: {response.status_code}")
print(response.text[:500])