Proof-of-Work & Clearance Cookies
The Cookie Landlords
The most popular anti-bot challenges do not permanently block you—they tax you. They issue a clearance cookie that proves you completed their challenge, then they let you through until the cookie expires. Understanding the mechanics of these cookies is the single highest-leverage skill in anti-bot work, because most challenges can be solved once and reused at speed.
The cf_clearance Cookie (Cloudflare)
When Cloudflare's managed challenge verifies a visitor, it sets cf_clearance—a signed, expiring credential bound to:
- The visitor's IP address at issue time.
- The target hostname it was issued for.
- A lifetime (typically 5 to 30 minutes, configurable by the site).
Any request for a cleared hostname that arrives bearing a valid cf_clearance skips the interstitial entirely. The catch is that the cookie is IP-bound: copy it to a different IP and it is rejected. That is why you must solve the challenge on the same IP you intend to use for scraping, and why a per-IP clearance farm is the classic scaling architecture.
The DataDome Legacy Cookie
Older DataDome setups used a similar token in a datadome cookie, verified on each subsequent request by a lightweight validator. Modern DataDome moved most of the defense to server-side evaluation of the fingerprint, but where legacy cookies persist, the same solve-once / reuse-until-IP-changes pattern applies.
Proof-of-Work Challenges
Some challenges skip fingerprinting entirely and require you to compute a proof of work. The page returns inline JS that chains a few thousand SHA-256 operations; the final hash becomes the cookie value. In a browser this takes several seconds and hundreds of milliseconds of CPU. Because the work is pure computation, a native reimplementation in Python or Go solves it in milliseconds—but the solver still needs to produce the correct input format and hash chain, which means you must reverse the exact algorithm. Automated PoW solvers exist for most popular challenge families and are significantly cheaper than human CAPTCHA farms.
The Solve-and-Replay Pipeline
The production pattern for clearance-cookie targets:
- Solve the challenge once inside a real browser (or a native PoW solver) on the working IP.
- Snapshot every cookie responsible for clearance (
cf_clearance,datadome, plus any session/visitor cookies it depends on). - Hand those cookies to a fast
curl_cffisession pinned to the same IP. - Scrape at high speed until the cookie nears expiry (usually 25 minutes of a 30-minute TTL for safety).
- Rotate to a new IP and repeat the solve.
This converts a "one browser = ten requests per minute" ceiling into "one solve = thousands of requests." The browser becomes an occasional cookie-making machine.
Cookie Rotation and Expiry Handling
Treat cookie expiry as a first-class state machine. Track the issue time and TTL for every clearance cookie; schedule the next solve before the previous cookie lapses so the queue never stalls. If a request returns a challenge page mid-stream, fall back to the browseless solve for that IP and continue—never hammer a challenged IP, because challenge pages themselves update WAF signals about your activities.