The short answer: most Cloudflare blocks are decided by your client's TLS and HTTP/2 fingerprint before your request is even read. To bypass Cloudflare, send the request from a client that fingerprints like a real browser, such as bogdanfinn/tls-client, and most Cloudflare-protected pages load like any other.
What remains are the pages where the site owner turned on a challenge:
- a "Just a moment..." page, which a solver service passes for you and turns into a
cf_clearancecookie - a Turnstile widget inside a form, which a solver turns into a token you submit with the form
Everything else in this post is about telling those cases apart, because each one needs a different fix.
The code below uses the current APIs of tls-client and AnySolver, checked on 14 November 2026.
How to bypass Cloudflare: first, find out which layer stopped you
"Cloudflare blocked me" covers several different responses. Look at the status, the headers and the body before changing anything.
| What you get | What it means | The fix |
|---|---|---|
403 with a "Just a moment..." page and the header cf-mitigated: challenge | A challenge page: the site wants proof you run a browser | Pass the challenge once, then reuse cf_clearance |
| Error 1010 | Browser Integrity Check failed: something about the request didn't look like a browser | A browser's User-Agent and headers, over a matching browser profile |
403 "Sorry, you have been blocked", or Error 1020 "Access denied" | A security rule the site owner configured matched you: often your IP, ASN, country or User-Agent | A different IP, sometimes from another country or network type |
| Error 1015 | You are rate limited | Slow down to a rate the site accepts, and back off when you see it |
| A page that loads, with a Turnstile widget in a form | The form, not the page, is protected | Solve the widget and submit the token |
200 with a near-empty page, and the network tab shows the data arriving from a JSON request | Usually not a block: the page loads its data from an API | Find that request and call it directly |
The last row matters more than it looks. Before fighting any protection, open DevTools, watch the network tab and check whether the data you want comes from a JSON endpoint. It returns structured data you don't have to parse out of HTML. Don't expect it to be easier to reach: it usually sits behind the same protection as the page. It is still worth checking, because sometimes it isn't. The API behind a site's mobile app, for example, is occasionally protected less carefully, or its security was simply overlooked.
Why your client gets a 403 before it says anything
The first message your client sends to a server is the TLS ClientHello. It lists the cipher suites, extensions and curves your client supports, in a specific order. Cloudflare hashes that into a fingerprint (JA3, and now JA4) and compares it with the fingerprints real browsers produce. The HTTP/2 connection settings get the same treatment.
Python's requests, httpx, Node's axios and curl all produce fingerprints no browser produces. Copying Chrome's headers and User-Agent is necessary but not enough: the handshake underneath them still says Python. A Chrome User-Agent on a Python handshake is a signal of its own, because the two disagree.
We covered this layer in depth in TLS fingerprinting vs anti-bots: what JA3, JA4 and the HTTP/2 fingerprint contain, and how to verify yours.
Bypass Cloudflare in Python with tls-client
bogdanfinn/tls-client is a Go HTTP client that reproduces real browsers' TLS and HTTP/2 fingerprints, built on forks of utls and net/http. It ships a library of browser profiles and has a Python binding (pip install tls-client), so you can use it from a Python scraper without changing languages.
In our work, this one change is what gets most Cloudflare-protected pages to load. Most sites rely on Cloudflare's default bot detection, and a correct fingerprint with coherent headers passes it.
import tls_client
PROXY = "http://user:pass@sticky-proxy.example:8000"
# Chrome 157's navigation headers, in the order Chrome sends them
HEADERS = {
"sec-ch-ua": '"Not-A.Brand";v="99", "Google Chrome";v="157", "Chromium";v="157"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"upgrade-insecure-requests": "1",
"user-agent": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36"
),
"accept": (
"text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/avif,"
"image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
),
"sec-fetch-site": "none",
"sec-fetch-mode": "navigate",
"sec-fetch-user": "?1",
"sec-fetch-dest": "document",
"accept-encoding": "gzip, deflate, br, zstd",
"accept-language": "en-US,en;q=0.9",
"priority": "u=0, i",
}
UA = HEADERS["user-agent"]
def chrome_order(headers: dict, body: bool = False) -> list[str]:
"""The order to send headers in, including the two the library writes itself:
cookie (from the session's jar) goes just before priority, as in Chrome,
and a request with a body starts with content-length."""
order = [name for name in headers if name != "priority"] + ["cookie", "priority"]
return ["content-length", *order] if body else order
session = tls_client.Session(
client_identifier="chrome_152_PSK", # TLS + HTTP/2 profile of Chrome 152, with session resumption
random_tls_extension_order=True, # real Chrome shuffles its extensions
)
session.headers.clear() # drop the library's default headers
session.proxies = PROXY
resp = session.get(
"https://protected.example.com/products",
headers=HEADERS,
header_order=chrome_order(HEADERS),
)
print(resp.status_code, resp.headers.get("cf-mitigated"))
Three things to keep coherent:
- Profile and headers. Chrome headers on a Chrome profile. A Firefox User-Agent on a Chrome handshake is an instant tell. The version numbers don't have to match exactly: the example sends Chrome 157 headers over
chrome_152_PSK, the newest PSK profile the Python binding ships. - Header order and context. Send what that browser sends, in its order. Set headers per request, not on the session: Chrome sends different headers for a page navigation, a
fetch()call and a form submit. Putcookiein the order too. The library adds it from the session's jar, and a header left out ofheader_orderis sent after all the others, a position Chrome never uses forcookie. - One session per identity. Keep the same session, cookies and IP together. Cookies earned on one IP and replayed from another look like session hijacking, which is what that pattern usually is.
In Go, the same client is a few lines longer; the TLS fingerprinting post has a full example.
When a challenge page remains: get cf_clearance
Some sites, or some routes on a site, are set to challenge every visitor, or every visitor Cloudflare is unsure about. You'll see a 403 with cf-mitigated: challenge and a "Just a moment..." page. A correct fingerprint doesn't make this go away: the page runs JavaScript, collects signals from a real browser environment, and sometimes asks for a Turnstile click.
Passing it sets a cf_clearance cookie, and requests carrying that cookie reach the site. You have two ways to get one:
- Solve it yourself by reversing the challenge script. That is a large, ongoing reverse engineering job, the subject of our post on reverse engineering anti-bot JavaScript.
- Use a solver service. Several commercial services pass Cloudflare challenges and Turnstile for you and return the cookie or token. They cost about $0.20 to $1.30 per 1,000 challenge solves at the prices listed on AnySolver in November 2026.
For most scrapers, option 2 is the right call. The example below uses AnySolver, which routes each task to one of many solving providers (2Captcha, CapSolver, CapMonster and others) through one API. Any service with a Cloudflare challenge task works the same way.
import time
import requests # plain requests is fine here: the solver's API is not protected
SOLVER = "https://api.anysolver.com"
KEY = "YOUR_ANYSOLVER_KEY"
def call(endpoint: str, **body) -> dict:
data = requests.post(f"{SOLVER}/{endpoint}", json={"clientKey": KEY, **body}, timeout=30).json()
if data["errorId"] != 0:
raise RuntimeError(f"{data.get('errorCode')}: {data.get('errorDescription')}")
return data
def solve(task: dict) -> dict:
task_id = call("createTask", task=task)["taskId"]
deadline = time.monotonic() + 31 * 60 # every AnySolver task ends within 30 minutes
while time.monotonic() < deadline:
time.sleep(1)
result = call("getTaskResult", taskId=task_id)
if result["status"] == "ready":
return result["solution"]
raise TimeoutError(f"task {task_id} did not finish")
The solver needs the URL that returned the challenge, the same proxy your scraper uses, and your User-Agent:
from urllib.parse import urlparse
url = "https://protected.example.com/products"
resp = session.get(url, headers=HEADERS, header_order=chrome_order(HEADERS))
if resp.headers.get("cf-mitigated") == "challenge":
solution = solve({
"type": "CloudflareChallengeCookie",
"websiteURL": url,
"proxy": PROXY,
"userAgent": UA,
})
if solution.get("userAgent") not in (None, UA):
raise RuntimeError(f"solver used another User-Agent: {solution['userAgent']}")
# Store every cookie the solve earned, not only cf_clearance, in the session's jar.
# set() replaces a cookie with the same name and domain, so a re-solve overwrites the stale one.
for name, value in solution["cookies"].items():
session.cookies.set(name, value, domain=urlparse(url).hostname)
resp = session.get(url, headers=HEADERS, header_order=chrome_order(HEADERS))
The rules that make cf_clearance keep working:
- It is tied to the IP and the User-Agent. Replay it through the same proxy that solved it, with the same User-Agent. A rotating proxy that changes address between the solve and your request gets challenged again. Use a sticky or static proxy per session.
- Check the User-Agent the solver used. The solution can carry the
userAgentit solved with, and the code above stops when it differs from yours. If a provider ignores yours, switch your profile and header to match theirs rather than sending a mismatched pair. - It expires. The site owner sets its lifetime. When the challenge comes back, solve again; don't treat a renewed challenge as a failure.
Cloudflare Turnstile bypass: when a form has a widget
Sometimes the page loads fine and only a form (a search, a quote request, a contact form) carries a Turnstile widget: a checkbox or a short "Verifying..." box. The page doesn't need clearing; the form submission needs a token.
Find the site key in the page source:
<div class="cf-turnstile" data-sitekey="0x4AAAAAAA..."></div>
Then solve the widget and submit the token in the form's cf-turnstile-response field. A form submit sends different headers from a navigation, so it gets its own set, copied from Chrome 157 submitting a form on the same site:
FORM_HEADERS = {
"cache-control": "max-age=0",
"sec-ch-ua": HEADERS["sec-ch-ua"],
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"upgrade-insecure-requests": "1",
"content-type": "application/x-www-form-urlencoded",
"user-agent": UA,
"origin": "https://protected.example.com",
"accept": HEADERS["accept"],
"sec-fetch-site": "same-origin",
"sec-fetch-mode": "navigate",
"sec-fetch-user": "?1",
"sec-fetch-dest": "document",
"referer": "https://protected.example.com/search", # the page that holds the form
"accept-encoding": "gzip, deflate, br, zstd",
"accept-language": "en-US,en;q=0.9",
"priority": "u=0, i",
}
token = solve({
"type": "TurnstileTokenProxyLess",
"websiteURL": "https://protected.example.com/search",
"websiteKey": "0x4AAAAAAA...",
})["token"]
resp = session.post(
"https://protected.example.com/search",
headers=FORM_HEADERS,
header_order=chrome_order(FORM_HEADERS, body=True),
data={"q": "rtx 5090", "cf-turnstile-response": token},
)
Turnstile tokens are valid for 300 seconds and can be validated once, so solve right before the request that uses it, never in advance. If the widget sets an action or cData (data-action/data-cdata on the element, or action/cData in turnstile.render()), pass them as pageAction and data. If the site rejects tokens solved from another address, use the TurnstileToken task with your proxy instead of the proxyless one. Turnstile solving costs about $0.10 to $2.00 per 1,000 tokens across the providers on AnySolver's Turnstile page in November 2026.
The tools compared
| Tool | Fingerprint | Runs the challenge | Speed and cost | Use it for |
|---|---|---|---|---|
requests, httpx, axios, curl | Not a browser's | No | Fastest | Unprotected sites and the solver's own API |
| tls-client (Go, Python) | Real browser's | No | Fast, cheap: no browser to run | Most Cloudflare-protected pages and APIs |
| Playwright, Puppeteer, Selenium | Real browser's | Yes, but automation is detectable | Slow, heavy: a browser per session | Low volume, or flows that truly need a browser |
| Solver service | Not applicable | Yes, on the provider's side | Paid per solve | Challenge pages and Turnstile on top of tls-client |
Headless browsers look like the obvious answer because they run the challenge themselves. In practice they are the expensive option: each session needs a full browser, they are slow to scale, and stock automation is detectable through signals such as navigator.webdriver. We use them when a flow truly needs a browser, not as the default.
Keeping access at scale
Getting one request through is the easy part. A scraper that runs every hour for a year fails differently:
- Sessions. Treat a session (IP, profile, cookies) as one identity and keep it together. Rotate whole identities, not single parts.
- IP quality. Datacenter ranges attract block rules quickly. Residential or mobile IPs cost more and hold up longer; match the type to how hard the target is.
- Rate. Error 1015 means you are faster than the site allows. Slow down and back off. Spreading the same load over more IPs keeps the load and invites a stricter rule.
- Detection of change. Cloudflare and site owners change settings without notice. Log status codes,
cf-mitigatedand error codes, and alert on a shift, not on the first failed request.
The collection systems we run handle over a million requests a day. Very little of that comes from clever tricks. It comes from the dull parts above: coherent sessions, measured rates and monitoring that notices when a target changes.
Where to stop
Getting past bot detection to read public pages is ordinary scraping work. It still has limits:
- Respect the terms and the law where you operate. Public data is not the same as data behind a login, and personal data comes with its own rules.
- Don't hammer a site. A rate the site can absorb keeps you running longer anyway.
And price it honestly: if you scrape a handful of shallow public pages, renting a scraping API may cost less than building any of this. We compared the options in custom scraper vs scraping API.
Key takeaways
- Find the layer first. A challenge page, a block page, error 1010, error 1015 and a Turnstile form each need a different fix.
- Most blocks are fingerprint blocks. A browser-accurate client like tls-client gets most Cloudflare-protected pages to load.
- Challenge pages and Turnstile go to a solver. Reuse
cf_clearancethrough the same IP and User-Agent; solve Turnstile right before the request. - Headless browsers are the expensive fallback, not the default.
- At scale, the boring parts win: coherent sessions, measured rates and monitoring.