Read the block before you change anything: did it come from the proxy or from the site, what is the status code, and which vendor markers came with it, such as cf-mitigated or x-amzn-waf-action. Most blocks come from pace, or from a client whose layers contradict each other, such as a Chrome User-Agent on Python’s TLS stack, more often than from the IP. Start at one request in flight per domain with about a second between requests, honour Retry-After, keep one exit, one browser identity and one cookie jar per session, use a real browser only where the page needs JavaScript, and stop when a site shows a challenge instead of trying to solve it at scale.
The short answer
- Read the block. Find out whether the proxy or the site answered, then look at the status code, the headers and the first lines of the body.
- Slow down per domain. One request in flight and about a second between requests is a sound start; let
429,503andRetry-Afterslow you further. - Keep one coherent identity per session: one exit IP, one browser or client, one cookie jar, no IP changes in the middle.
- Use a real browser only where the page needs JavaScript, and look for the site’s API, sitemap or feed first.
- Stop when the site says stop. A challenge, a CAPTCHA or a block page is an answer, not a puzzle to farm out.
Stack Overflow’s most-viewed questions on this topic, “How do I avoid HTTP error 403 when web scraping with Python?” (357,000 views) and its relatives, are mostly from 2013 to 2016, and so is much of the advice still copied into ranking pages.
What changed since 2024
| When | Change | What it means for a scraper |
|---|---|---|
| 24 Jun 2024 | Cloudflare starts classifying residential proxy traffic per request, more than 17 million IPs an hour | A residential IP no longer hides automated traffic by itself |
| 2024 | Google stops showing cached copies of pages | Advice to “scrape the Google cache” is dead |
| 15 Jan 2025 | Google Search requires JavaScript | Plain HTTP clients no longer get results pages |
| Chrome 132, 2025 | The old headless mode moves to a separate binary, chrome-headless-shell | Headless and headed Chrome now differ in more ways than one flag |
| 1 Jul 2025 | Cloudflare blocks AI crawlers by default and tests pay per crawl with HTTP 402 | Many sites now refuse unidentified crawlers outright |
| 2 Jul 2025 | Scrapy’s project template moves to one request per domain and a 1-second delay | Polite defaults are the norm in the main framework |
| May and Aug 2025 | Cloudflare launches Web Bot Auth and signed agents | Honest bots can now prove who they are with signatures |
| 20 and 31 Jul 2026 | Courts in Google v. SerpApi and Reddit v. SerpApi treat getting around Google’s SearchGuard as possible DMCA circumvention | “Bypassing” bot protection is now a legal question, not only a technical one |
| 10 Sep 2026 | Scrapy 2.19 adds delay jitter by default | Random spacing between requests is built in |
First, read the block
A status code alone is not a diagnosis. Log the status, the headers (server, cf-mitigated, x-amzn-waf-action, retry-after), the cookies and the first two kilobytes of the body for every failure, then match them here:
| What you see | Who answered and why | What to do |
|---|---|---|
403 with cf-mitigated: challenge, an HTML “Just a moment…” page | Cloudflare wants a browser challenge solved; plain HTTP clients cannot | Use the site’s API or feed if there is one; if the page needs a browser, use a real one at a human pace |
Cloudflare error 1020, “Access denied” | A rule the site’s owner set up to block you | Stop; contact the owner with the Ray ID if your access is legitimate |
Cloudflare error 1010 | The browser integrity check flagged a non-browser client | For APIs on Workers or Pages, Cloudflare itself recommends a descriptive User-Agent such as my-app/1.0 |
Cloudflare error 1015 | A rate limit the site set | Slow down; repeated tries “may extend the block” |
202 or 405 with x-amzn-waf-action | AWS WAF asks for a challenge (202) or a CAPTCHA (405) | Fewer requests per session; never reuse a token from other IPs |
403 with a datadome cookie or X-DataDome headers | DataDome’s bot decision | Check pace and the consistency of your client |
403 after a run of successes | Often a rate limit disguised as 403 | Back off and lower concurrency; rotating IPs to dodge it is evasion |
429, often with Retry-After | The site’s rate limit | Wait as told, then slow down |
503 | Overload or maintenance | Back off; Google’s own crawler slows a whole host on many 429s and 503s |
200, but a CAPTCHA or the wrong content | A soft block | Check the content as well as the status, and count it as a failure |
200 with an empty shell | The page is built by JavaScript | Find its JSON endpoint, or render it |
| A consent page instead of content | An EU or UK visitor gets a consent wall | Choose an exit in the market you study, and keep consent cookies in a sticky session |
451 | Blocked for legal reasons | Do not route around it |
407, or a non-2xx answer to CONNECT | The proxy, before the site was reached | Fix the credentials or the target; the site never saw the request |
Work through it in that order: proxy or site first, then any vendor marker, then whether the failure is rate-shaped (it starts after a number of requests), client-shaped (it fails from the first request and works in a browser) or content-shaped (a 200 with the wrong page). We sent one request from our server to the IETF Datatracker’s JSON API on 26 October 2026, with an honest User-Agent, and got HTTP/2 403 with cf-mitigated: challenge and an HTML body, a JSON API answering with a browser challenge.
Through our gateway, errors on the proxy side arrive as the answer to the tunnel request and carry an X-Reason header: 407 for credentials or an unknown targeting key, 402 when the traffic runs out, 403 for targets blocked by default such as government sites, and 429 after too many failed logins from one address, or when free trial traffic exceeds the trial’s connection limit. A 429 from inside the tunnel is the site’s. Python reports a proxy refusal as Tunnel connection failed, the subject of a Stack Overflow question with 53,000 views; when you see it, the site was never reached. Our HTTP proxies guide has the full table of proxy errors.
How sites decide you are a bot
Bot protection in 2026 layers several kinds of evidence and scores them together. Cloudflare and AWS document theirs in the most detail; Akamai, DataDome, HUMAN, Kasada and Imperva describe theirs at a higher level. Automated traffic is now about half of the web: the 2025 Imperva report put it at 51%, and Cloudflare counted 47% of HTML requests as human in 2025. The common thread across vendors is consistency:
| Layer | What the site checks | What a careless scraper sends | The fix |
|---|---|---|---|
| IP and network | Network type, reputation, location | A cloud IP, or an exit shared with other bots | An exit type and country that fit the site |
| Rate and pattern | Requests per IP, per session, per fingerprint | Bursts and many parallel connections | Per-domain caps and an adaptive delay |
| TLS and HTTP/2 | How the client opens its connections (JA4, HTTP/2 settings) | Python’s TLS under a Chrome User-Agent | A real browser when you claim to be one, an honest client name otherwise |
| Headers and Client Hints | Names, order and agreement between them | Random User-Agent strings, missing Accept-Language, Client Hints that contradict the User-Agent | One coherent set per session |
| Cookies and tokens | Whether a session stays continuous | One token used from several IPs or countries | One exit per session |
| JavaScript checks | Challenges and browser fingerprinting | No JavaScript on a page that needs it | A real browser, or the site’s API |
| Automation traces | navigator.webdriver, “HeadlessChrome”, DevTools side effects | Default headless settings | Expect them to be seen; a site may refuse automated browsers |
| Behaviour | Paths, timing and interaction | Every product page in sorted order with no pauses | Natural pacing; fetch only what you need |
Cloudflare’s bot score gives a request with a missing or empty User-Agent a score of 1, “quite certain the request was automated”. AWS WAF’s Bot Control flags one session token seen from more than two IPs, or from more than one country or network, within five minutes: changing IPs in the middle of a session is a signal in its own right. And since Chromium shuffled the order of TLS extensions in 2023, the JA3 fingerprint many guides still mention has given way to JA4, which Cloudflare, AWS, Google Cloud, Akamai and Fastly now support.
Pace like a good crawler
Start with robots.txt. RFC 9309 standardised it in 2022: the file lives at /robots.txt, the most specific rule wins, a 5xx answer means “assume everything is disallowed”, and a copy should not be cached for more than 24 hours. Two common beliefs are wrong. Crawl-delay is not part of the standard, and Google ignores it, although Cloudflare expects AI crawlers to respect it. And robots.txt is “not a form of access authorization”, so it does not make a page private, but terms of service can refer to it.
Then set a pace. Since version 2.13.3 in July 2025, Scrapy’s project template starts new projects at one request in flight per domain and a one-second delay, with half a second of random jitter since 2.19. Its AutoThrottle extension adapts the delay to the site’s response time and never lets error responses speed things up. Those are sensible defaults for any stack: raise concurrency only while response times and error rates stay flat.
When a site does push back, wait as told. Retry-After comes in two forms, a number of seconds or an HTTP date, and code that calls int() on it breaks on the second. Retry only requests that are safe to repeat, and spread retries with capped exponential backoff and full jitter, which AWS’s analysis found does the least work of the common schemes:
import random, time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
def retry_after_seconds(value):
"""Retry-After is either a number of seconds or an HTTP date."""
if not value:
return None
if value.strip().isdigit():
return int(value)
when = parsedate_to_datetime(value)
return max(0.0, (when - datetime.now(timezone.utc)).total_seconds())
def backoff(attempt, base=1.0, cap=60.0):
"""capped exponential backoff with full jitter"""
return random.uniform(0, min(cap, base * 2 ** attempt))
def polite_get(session, url, attempts=5):
for attempt in range(attempts):
r = session.get(url, timeout=30)
if r.status_code not in (429, 503):
return r
wait = retry_after_seconds(r.headers.get("Retry-After"))
time.sleep(wait if wait is not None else backoff(attempt))
return r
Our Acceptable Use Policy asks for the same thing in plain words: keep request rates reasonable for the size of the site, and slow down when it answers 429 or 503.
Fetch less
Before you scrape HTML, look for an official API, a feed, or the JSON endpoint the page itself calls; open the browser’s network tab and watch what loads. Sitemaps list up to 50,000 URLs per file with a lastmod date that tells you what changed, and robots.txt usually points to them with a Sitemap: line.
For pages you fetch again, ask the site whether they changed. A conditional request with If-None-Match gets a 304 Not Modified and no body when nothing changed (RFC 9110), which costs the site almost nothing and you almost no traffic:
etags = {} # url -> ETag from the last full response
def fetch_if_changed(session, url):
headers = {"If-None-Match": etags[url]} if url in etags else {}
r = session.get(url, headers=headers, timeout=30)
if r.status_code == 304:
return None # unchanged, nothing downloaded
if "ETag" in r.headers:
etags[url] = r.headers["ETag"]
return r
Scrapy’s HTTP cache can do the same with its RFC 2616 policy, revalidating stale responses with ETag and Last-Modified.
Headers and User-Agents: coherence beats rotation
Random User-Agent rotation is the most copied tip on the web, and in 2026 it mostly hurts. Chrome froze most of its User-Agent string in 2022 and 2023: only the major version still changes, and platform details moved to Client Hints such as Sec-CH-UA, which Chrome sends by default and which have to agree with the User-Agent. Under both sit the TLS and HTTP/2 fingerprints, which have to agree with the browser you claim to be. A Chrome 157 User-Agent sent by Python’s requests, which speaks only HTTP/1.1, contradicts itself on every request.
Pick one of two honest options per session. If you need a browser, run a real one and let it send its own headers. If you do not, send a descriptive name for your client: Cloudflare’s own advice for API clients is a User-Agent such as my-app/1.0, and RFC 9110 says a robot should send a From header with a contact address. Crawlers that run at scale can go further with Web Bot Auth, which signs requests so a site can verify who sent them, or apply for Cloudflare’s verified bot programme.
Our IP checker shows whether a browser’s User-Agent, Accept-Language and Client Hints agree between HTTP and JavaScript, which is the quickest way to spot a profile that contradicts itself.
Real browsers: when you need one
Use a browser when the content is built by JavaScript and there is no API behind it, when a site requires JavaScript as Google Search has since January 2025, or when you need what a user really sees, such as a rendered price or an ad. Otherwise a plain HTTP client is faster, cheaper and easier on the site.
Expect automation to be visible. The W3C WebDriver standard sets navigator.webdriver to true on purpose, so that a page knows it is under remote control. Headless Chromium announces “HeadlessChrome” in its User-Agent unless told otherwise, and since Chrome 132 the old headless mode lives on as a separate chrome-headless-shell binary, which Playwright uses for headless runs since version 1.57. The stealth plugins many guides recommend are stale: puppeteer-extra-plugin-stealth was last published on 1 March 2023, and Castle, a detection company, wrote in November 2025 that detection has moved on to side effects of the DevTools protocol itself.
Browsers are also expensive in traffic. You can block images, fonts and video, but in Playwright the request routing that does it also disables the HTTP cache, so scripts and stylesheets may be fetched again on every page. Measure both ways on your own targets.
Proxies: rotation, sticky sessions and geography
A proxy changes where your requests come from. It does not fix pace, headers or a client that contradicts itself, and since Cloudflare classifies residential proxy traffic per request, a residential IP does not hide automated traffic either. What the right proxy setup does is keep the network layer consistent with everything else:
| Job | Session | Why |
|---|---|---|
| Independent pages: catalogue pages, one-off lookups | Rotate per request | Breadth, and no state to carry |
| Anything with state: cookies, consent, pagination tokens, carts, clearance tokens | Sticky, one exit for the whole flow | A token seen from several IPs is flagged |
| Prices, search results or content by market | An exit in the country, state or city you study, where available | Sites localise; consent walls appear for EU visitors |
| A session the site has started to refuse | Retire the session, cookies and exit together | Changing only the IP mid-session is a signal; Crawlee retires sessions on 401, 403 and 429 |
On our gateway, a login without a session key rotates per connection, and -sid-<key>-time-<seconds> holds one exit for up to 6 hours; -cc-, -st- and -city- choose the country, state and city. Remember that clients keep connections open: a requests.Session sent four requests through one exit in our test, while four separate calls got four exits. Which proxy type a site needs is a separate question, and our comparison of residential and datacenter proxies suggests starting with the cheapest type and switching on evidence.
Two cautions. Shared mobile addresses are not a free pass: Cloudflare found in October 2025 that carrier NAT addresses are rate-limited about three times as often as others. And more IPs do not mean more throughput when the site counts per session, per token or per fingerprint; spreading one job over a thousand exits only makes it look like a thousand bots.
Measure success and cost per page
Count a success as a 2xx response with the content you expected, not any 200. Track per target domain and per day: the success rate, blocks by signature (cf-mitigated, 1015, 429, AWS 202 and 405, soft blocks), median latency, bytes per successful page, retries per success and cost per successful page. Retries multiply cost by roughly one divided by the success rate: going from 50% to 90% success cuts the cost of each good page by 44%.
Bytes decide most of the bill on per-GB proxies. The HTTP Archive’s Web Almanac 2025 puts the median home page at about 22 KB of HTML and 2.6 MB fully loaded on mobile:
| What you fetch | About | Pages per GB | Per 1,000 pages at $3.49/GB | At $1.69/GB |
|---|---|---|---|---|
| Raw HTML | 22 KB | about 45,000 | $0.08 | $0.04 |
| Rendered, images, fonts and video blocked | 1.25 MB | about 800 | $4.36 | $2.11 |
| Fully rendered home page | 2.6 MB | about 385 | $9.07 | $4.39 |
The prices are our residential tiers for 1–9 GB and 1,000 GB or more. Medians vary by site, so measure a few of your own pages. The first and last rows differ by a factor of more than a hundred, so the site’s JSON endpoint beats a browser whenever there is one.
Tools in 2026 and what they are for
| Tool | What it is for | Version, October 2026 | Notes |
|---|---|---|---|
| Playwright | Automating Chromium, Firefox and WebKit | 1.64.1 | Proxy per browser context; headless runs use chrome-headless-shell |
| Puppeteer | Automating Chrome | 25.16.0 | Proxy credentials through page.authenticate |
| Selenium | The WebDriver standard, many languages | 4.51.0 | Sets navigator.webdriver by design |
| Scrapy | Crawling framework for Python | 2.19.0 | Polite defaults, AutoThrottle, HTTP cache |
| Crawlee | Crawling framework for Node.js and Python | 3.18.2 | Session pool that pairs sessions with proxies |
| curl_cffi | Python HTTP client with browser-like TLS and HTTP/2 | 0.17.0 | Its newest Chrome profiles are 151 and 152, while stable Chrome is 155–157 |
| puppeteer-extra-plugin-stealth | Hiding headless Chrome | Last release 1 Mar 2023 | Unmaintained |
| undetected-chromedriver | Hiding Selenium-driven Chrome | Last release 17 Feb 2024 | Replaced by its author’s nodriver |
Managed scraping APIs sell the whole job instead. On their pricing pages in October 2026, Zyte, Bright Data, ZenRows, ScrapingBee and ScraperAPI charged roughly $0.06–1.30 per 1,000 simple successful requests and about $1–16 per 1,000 rendered or “protected” pages, most of them only for successful requests. Whether that beats your own stack plus proxies is a cost-per-page question.
Where the line is
Most of this guide is about being a good guest. Some techniques go further, and since 2026 the courts have had something to say about them:
| Fine | Over the line |
|---|---|
| Reading and obeying robots.txt | Solving or farming CAPTCHAs and JavaScript challenges at scale |
| Capping your rate and honouring 429, 503 and Retry-After | Reusing or passing solved challenge tokens between clients |
| Identifying your crawler: a descriptive User-Agent, a From header, Web Bot Auth | Pretending to be Googlebot or another verified bot |
| A real browser at a human pace where the page needs JavaScript | Reverse-engineering a vendor’s sensor scripts |
| One coherent session, with an exit in the market you study | Rotating IPs to get around a rate limit the site set |
| Official APIs, licensed data, logged-out public pages | Fake accounts, or logged-in scraping against the terms |
| Personal data only with a lawful basis | Personal data without one |
In Reddit v. SerpApi, a New York federal court ruled on 31 July 2026 that Google’s SearchGuard is a technological measure that controls access under the DMCA, and let the circumvention claims go ahead. Eleven days earlier, in Google’s own case against SerpApi, a California court dismissed most claims but found circumvention adequately alleged, including making automated queries appear human and passing a solved challenge to browsers that never solved it. Both are rulings on early motions, not verdicts. In the EU, scraping personal data needs a lawful basis, and the EDPB’s 2024 report says the GDPR’s duty to inform people applies to it.
No court has held that using a proxy is circumvention in itself. Our guide to the 2022–2026 court cases has the details, and for search results our SERP proxies page and rankings guide explain what we do and do not publish. This is not legal advice.
Myths, corrected
| Myth | What is true in 2026 |
|---|---|
| Rotate User-Agents randomly on every request | Chrome’s User-Agent is frozen except the major version, Client Hints must match it, and TLS and HTTP/2 must match both |
| Residential proxies make you undetectable | Cloudflare classifies residential proxy traffic per request, and fingerprinted crawlers that rotated IPs and networks |
| A 403 means your IP is banned | It can be a challenge, an owner’s rule, a browser check, a disguised rate limit, or the proxy refusing the tunnel |
| Crawl-delay is standard and Google honours it | It is not in RFC 9309, and Google ignores it |
| Scrape the Google cache instead | Google stopped showing cached pages in 2024 |
| A stealth plugin makes headless Chrome undetectable | The best-known one was last released in March 2023, and detection has moved to DevTools side effects |
| HTTP 200 means it worked | AWS challenges return 202, and some vendors serve block pages with 200 |
| Retry at once, or switch IP on a 429 | Honour Retry-After and back off; Cloudflare warns that repeated tries can extend a 1015 block |
| JA3 is the TLS fingerprint to worry about | Since Chromium shuffled TLS extensions in 2023, JA4 has replaced it at the major vendors |
| More IPs means more throughput | Sites count per session, token and fingerprint, and shared carrier IPs are rate-limited about three times as often |
The checklist
Copy it into your project’s README:
- Log the status, the
server,cf-mitigated,x-amzn-waf-actionandretry-afterheaders, the cookies and the first 2 KB of the body for every failure. - Check whether the error came from the proxy (an answer to CONNECT, or 407) or from the site.
- Fetch robots.txt, cache it for no more than 24 hours, and obey it; read the sitemap.
- Look for an official API, a feed or a JSON endpoint before you scrape HTML.
- Start at one request in flight per domain with about a second of delay and some jitter; let latency, 429 and 503 adjust it.
- Honour Retry-After in both forms; otherwise use capped exponential backoff with full jitter, and retry only requests that are safe to repeat.
- Use conditional requests and cache what you fetch.
- Keep one exit IP, one browser or client and one cookie jar per session, with no IP changes in the middle.
- Rotate per request only for independent URLs; use sticky sessions, up to 6 hours on our gateway, for anything with state.
- Match the exit’s country, state or city to the market you measure, and handle consent pages on purpose.
- Use a real browser only where JavaScript is required; block images and fonts if it saves traffic in your tests.
- Identify yourself where you can: a descriptive User-Agent, a From header, Web Bot Auth for crawlers.
- Count success as a 2xx with the expected content; track blocks by signature and cost per successful page.
- Stop on challenges, CAPTCHAs, 1020 and 451. Do not solve them at scale, reuse tokens or pretend to be a verified bot.
- Collect logged-out public data, and personal data only with a lawful basis.
To check the proxy side before a run, the proxy tester tests status, speed and location for a list of proxies, and the documentation lists the gateway’s login options.
Published Oct 26, 2026. We update this guide when the platforms change; dated facts above are as of publication.