Web scraping without blocks: diagnose the 403, then fix pacing, sessions and headers

Most blocked scrapers are told why, if you read the whole response. This is the checklist we go through when a customer asks why their scraper gets 403s: how to read the block, how sites decide you are a bot in 2026, and the pacing, session and header fixes that solve most of them.

APAeonProxy team·Oct 26, 2026·17 min read
THE SHORT VERSION

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

  1. 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.
  2. Slow down per domain. One request in flight and about a second between requests is a sound start; let 429, 503 and Retry-After slow you further.
  3. Keep one coherent identity per session: one exit IP, one browser or client, one cookie jar, no IP changes in the middle.
  4. Use a real browser only where the page needs JavaScript, and look for the site’s API, sitemap or feed first.
  5. 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

WhenChangeWhat it means for a scraper
24 Jun 2024Cloudflare starts classifying residential proxy traffic per request, more than 17 million IPs an hourA residential IP no longer hides automated traffic by itself
2024Google stops showing cached copies of pagesAdvice to “scrape the Google cache” is dead
15 Jan 2025Google Search requires JavaScriptPlain HTTP clients no longer get results pages
Chrome 132, 2025The old headless mode moves to a separate binary, chrome-headless-shellHeadless and headed Chrome now differ in more ways than one flag
1 Jul 2025Cloudflare blocks AI crawlers by default and tests pay per crawl with HTTP 402Many sites now refuse unidentified crawlers outright
2 Jul 2025Scrapy’s project template moves to one request per domain and a 1-second delayPolite defaults are the norm in the main framework
May and Aug 2025Cloudflare launches Web Bot Auth and signed agentsHonest bots can now prove who they are with signatures
20 and 31 Jul 2026Courts 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 2026Scrapy 2.19 adds delay jitter by defaultRandom 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 seeWho answered and whyWhat to do
403 with cf-mitigated: challenge, an HTML “Just a moment…” pageCloudflare wants a browser challenge solved; plain HTTP clients cannotUse 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 youStop; contact the owner with the Ray ID if your access is legitimate
Cloudflare error 1010The browser integrity check flagged a non-browser clientFor APIs on Workers or Pages, Cloudflare itself recommends a descriptive User-Agent such as my-app/1.0
Cloudflare error 1015A rate limit the site setSlow down; repeated tries “may extend the block”
202 or 405 with x-amzn-waf-actionAWS 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 headersDataDome’s bot decisionCheck pace and the consistency of your client
403 after a run of successesOften a rate limit disguised as 403Back off and lower concurrency; rotating IPs to dodge it is evasion
429, often with Retry-AfterThe site’s rate limitWait as told, then slow down
503Overload or maintenanceBack off; Google’s own crawler slows a whole host on many 429s and 503s
200, but a CAPTCHA or the wrong contentA soft blockCheck the content as well as the status, and count it as a failure
200 with an empty shellThe page is built by JavaScriptFind its JSON endpoint, or render it
A consent page instead of contentAn EU or UK visitor gets a consent wallChoose an exit in the market you study, and keep consent cookies in a sticky session
451Blocked for legal reasonsDo not route around it
407, or a non-2xx answer to CONNECTThe proxy, before the site was reachedFix 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:

LayerWhat the site checksWhat a careless scraper sendsThe fix
IP and networkNetwork type, reputation, locationA cloud IP, or an exit shared with other botsAn exit type and country that fit the site
Rate and patternRequests per IP, per session, per fingerprintBursts and many parallel connectionsPer-domain caps and an adaptive delay
TLS and HTTP/2How the client opens its connections (JA4, HTTP/2 settings)Python’s TLS under a Chrome User-AgentA real browser when you claim to be one, an honest client name otherwise
Headers and Client HintsNames, order and agreement between themRandom User-Agent strings, missing Accept-Language, Client Hints that contradict the User-AgentOne coherent set per session
Cookies and tokensWhether a session stays continuousOne token used from several IPs or countriesOne exit per session
JavaScript checksChallenges and browser fingerprintingNo JavaScript on a page that needs itA real browser, or the site’s API
Automation tracesnavigator.webdriver, “HeadlessChrome”, DevTools side effectsDefault headless settingsExpect them to be seen; a site may refuse automated browsers
BehaviourPaths, timing and interactionEvery product page in sorted order with no pausesNatural 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:

JobSessionWhy
Independent pages: catalogue pages, one-off lookupsRotate per requestBreadth, and no state to carry
Anything with state: cookies, consent, pagination tokens, carts, clearance tokensSticky, one exit for the whole flowA token seen from several IPs is flagged
Prices, search results or content by marketAn exit in the country, state or city you study, where availableSites localise; consent walls appear for EU visitors
A session the site has started to refuseRetire the session, cookies and exit togetherChanging 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 fetchAboutPages per GBPer 1,000 pages at $3.49/GBAt $1.69/GB
Raw HTML22 KBabout 45,000$0.08$0.04
Rendered, images, fonts and video blocked1.25 MBabout 800$4.36$2.11
Fully rendered home page2.6 MBabout 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

ToolWhat it is forVersion, October 2026Notes
PlaywrightAutomating Chromium, Firefox and WebKit1.64.1Proxy per browser context; headless runs use chrome-headless-shell
PuppeteerAutomating Chrome25.16.0Proxy credentials through page.authenticate
SeleniumThe WebDriver standard, many languages4.51.0Sets navigator.webdriver by design
ScrapyCrawling framework for Python2.19.0Polite defaults, AutoThrottle, HTTP cache
CrawleeCrawling framework for Node.js and Python3.18.2Session pool that pairs sessions with proxies
curl_cffiPython HTTP client with browser-like TLS and HTTP/20.17.0Its newest Chrome profiles are 151 and 152, while stable Chrome is 155–157
puppeteer-extra-plugin-stealthHiding headless ChromeLast release 1 Mar 2023Unmaintained
undetected-chromedriverHiding Selenium-driven ChromeLast release 17 Feb 2024Replaced 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:

FineOver the line
Reading and obeying robots.txtSolving or farming CAPTCHAs and JavaScript challenges at scale
Capping your rate and honouring 429, 503 and Retry-AfterReusing or passing solved challenge tokens between clients
Identifying your crawler: a descriptive User-Agent, a From header, Web Bot AuthPretending to be Googlebot or another verified bot
A real browser at a human pace where the page needs JavaScriptReverse-engineering a vendor’s sensor scripts
One coherent session, with an exit in the market you studyRotating IPs to get around a rate limit the site set
Official APIs, licensed data, logged-out public pagesFake accounts, or logged-in scraping against the terms
Personal data only with a lawful basisPersonal 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

MythWhat is true in 2026
Rotate User-Agents randomly on every requestChrome’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 undetectableCloudflare classifies residential proxy traffic per request, and fingerprinted crawlers that rotated IPs and networks
A 403 means your IP is bannedIt 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 itIt is not in RFC 9309, and Google ignores it
Scrape the Google cache insteadGoogle stopped showing cached pages in 2024
A stealth plugin makes headless Chrome undetectableThe best-known one was last released in March 2023, and detection has moved to DevTools side effects
HTTP 200 means it workedAWS challenges return 202, and some vendors serve block pages with 200
Retry at once, or switch IP on a 429Honour Retry-After and back off; Cloudflare warns that repeated tries can extend a 1015 block
JA3 is the TLS fingerprint to worry aboutSince Chromium shuffled TLS extensions in 2023, JA4 has replaced it at the major vendors
More IPs means more throughputSites 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:

  1. Log the status, the server, cf-mitigated, x-amzn-waf-action and retry-after headers, the cookies and the first 2 KB of the body for every failure.
  2. Check whether the error came from the proxy (an answer to CONNECT, or 407) or from the site.
  3. Fetch robots.txt, cache it for no more than 24 hours, and obey it; read the sitemap.
  4. Look for an official API, a feed or a JSON endpoint before you scrape HTML.
  5. Start at one request in flight per domain with about a second of delay and some jitter; let latency, 429 and 503 adjust it.
  6. Honour Retry-After in both forms; otherwise use capped exponential backoff with full jitter, and retry only requests that are safe to repeat.
  7. Use conditional requests and cache what you fetch.
  8. Keep one exit IP, one browser or client and one cookie jar per session, with no IP changes in the middle.
  9. Rotate per request only for independent URLs; use sticky sessions, up to 6 hours on our gateway, for anything with state.
  10. Match the exit’s country, state or city to the market you measure, and handle consent pages on purpose.
  11. Use a real browser only where JavaScript is required; block images and fonts if it saves traffic in your tests.
  12. Identify yourself where you can: a descriptive User-Agent, a From header, Web Bot Auth for crawlers.
  13. Count success as a 2xx with the expected content; track blocks by signature and cost per successful page.
  14. Stop on challenges, CAPTCHAs, 1020 and 451. Do not solve them at scale, reuse tokens or pretend to be a verified bot.
  15. 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.

Frequently asked questions

Because the site refuses your client rather than the request: a library User-Agent, a TLS and HTTP version that do not match the browser you claim to be, or a JavaScript challenge a plain client cannot run. Look for markers such as cf-mitigated before you change anything.

429 is a rate limit, often with a Retry-After header telling you how long to wait. 403 is a refusal, which can be a challenge, a rule the owner set or a disguised rate limit.

Cloudflare answered with a challenge page instead of the content you asked for. A plain HTTP client cannot complete it; use the site’s API, or a real browser at a human pace, and do not solve challenges at scale.

Not randomly. Keep one coherent identity per session: a real browser with its own headers, or an honest name for your client. A random User-Agent on a client whose TLS and HTTP/2 say otherwise contradicts itself.

There is no universal number. Start at one request in flight per domain with about a second between requests, which is Scrapy’s default since July 2025, and slow down as soon as the site answers 429 or 503.

Rotating for independent pages, sticky for anything that carries state, such as cookies, consent, pagination or a checkout. Using one session token from several IPs is itself flagged by systems such as AWS WAF.

Because the IP is only one layer. Cloudflare classifies residential proxy traffic per request, and pace, headers, TLS and behaviour still count. Fix the client and the pace first.

Accept both forms, a number of seconds or an HTTP date, wait at least that long, and fall back to capped exponential backoff with jitter when the header is missing.

Only when the content needs JavaScript and has no API behind it. A median home page is about 22 KB of HTML but 2.6 MB fully loaded, so rendering can cost a hundred times more traffic.

Collecting logged-out public data is the low-risk case in most places, and personal data needs a lawful basis in the EU. Getting around access controls, including solving challenges at scale, is where 2026 court rulings drew the line. This is not legal advice.

Related pages

Collect public data the polite way.