NEWStandard createTask and in.php APIs. Change the address and you are connected.View API docs
GATESOLVER

Cloudflare

Cloudflare 403 Forbidden while scraping

A 403 from Cloudflare is not one problem but several that share a status code. Some are checks you can pass, some are signals to change how you send traffic, and some are decisions you have to accept.

Four different things behind one status code

HTTP 403 means "the server understood the request and refuses to fulfil it". When Cloudflare sits in front of a site, it can return 403 for reasons that have nothing to do with each other:

  1. A challenge. Cloudflare wants the client to prove it is a browser. The 403 body is the "Just a moment" page and the response carries cf-mitigated: challenge.
  2. A firewall rule. The site owner wrote a rule that blocks your request by country, path, user agent, IP range or other fields. The body is an "Access denied" page, often with error 1020.
  3. Bot management. Cloudflare's own scoring judged the request automated and the owner's configuration blocks such traffic rather than challenging it.
  4. The origin. The site's own server returned 403, and Cloudflare simply passed it on. The body then looks like the site, not like Cloudflare.

Before changing anything, find out which one you have. The quickest way is to save the full response, headers and body, the first time it happens. The guide on how to tell Cloudflare protections apart includes a classifier you can drop into your code.

The challenge 403

This is the most common 403 for scrapers and the one with the clearest path. The page is a managed challenge, and a real browser would run its script and receive a cf_clearance cookie. An HTTP client cannot run the script, but it can obtain the cookie from a solving task and then send it with every request, from the same IP and with the same user agent. The language guides for Python and Node.js walk through it.

Two details make or break this. The proxy must keep one IP for the life of the cookie, because the clearance is bound to the IP that earned it. And every request must use the user agent from the solution; switching it invalidates the cookie.

The firewall rule 403

Site owners use Cloudflare's WAF custom rules to decide who may reach their site. A rule might block a country, a path such as /api/, a list of known crawler user agents, entire hosting provider networks, or requests missing certain headers. When a rule's action is "Block", the visitor gets 403 with an Access denied page. There is no challenge to pass, because the owner chose not to offer one.

What you can and cannot do here is worth stating plainly. You cannot solve a block; it is a policy, and no task, cookie or token reverses it. If the rule matched something incidental about your requests, such as a bare library user agent or a data center IP range that ordinary visitors never use, sending normal browser headers from a more typical network may mean the rule no longer matches. If the rule targets your use, the right move is to stop, or to ask the site for access through an API or a data agreement. The glossary entry on the web application firewall describes how these rules work.

The reputation 403

Some 403s come from the reputation of the network rather than from anything in the request. Addresses with a long history of automated traffic, many hosting provider ranges, and some shared proxy pools carry poor reputations across many sites. Owners can configure Cloudflare to block traffic it scores as likely automated, or to block certain network groups (ASNs) entirely. The same script that works from one network may get 403 on every request from another.

Here the client side has real influence. Requests from residential or mobile networks, at moderate rates, with consistent sessions, are treated differently from bursts out of a data center. The entries on IP reputation and residential proxies cover the background. None of this is a way around an owner's explicit decision; it is about not looking like the abuse that reputation systems are built to catch.

The fingerprint 403

Cloudflare also looks at how a client connects. The TLS handshake (which ciphers and extensions it offers, in what order), the HTTP/2 settings and the order of headers form a fingerprint that differs between Chrome, Firefox, curl, Python's requests and Go's net/http. A request that claims to be Chrome in its user agent but connects like a Python library is an obvious mismatch. Bot management uses such signals, and on strict sites they can lead to challenges on every request or a 403 outright.

The client controls this, within limits. Options include using a real browser through Playwright or Puppeteer, or an HTTP library built to reproduce browser handshakes. Keep the claimed browser and the actual handshake consistent: an honest library user agent is often treated better than a Chrome string on a non Chrome connection. The TLS fingerprinting entry in the glossary goes into how handshakes are compared.

What helps, summarized

CauseHow to recognise itWhat helps
Challengecf-mitigated: challenge, Just a moment pageObtain cf_clearance with the challenge task, reuse it from the same IP and user agent
Firewall ruleAccess denied page, error 1020Nothing on the solving side; avoid incidental matches, or ask the site for access
Reputation403 from some networks, not othersBetter networks, lower rates, steady sessions
FingerprintBrowser works, script gets 403 from the same IPA real browser or a client whose handshake matches its user agent
OriginBody looks like the site, not CloudflareCheck credentials, paths and the site's own rules

A debugging routine that works

Start with the browser. Open the URL in a normal browser from the same network your scraper uses. If you get the same 403 page, the problem is your IP or a rule; changing your code will not help. If the browser shows a challenge and then the page, you are facing a challenge your script can handle with a clearance cookie. If the browser loads the page directly while the script gets 403, the difference is in the client: headers, cookies, or fingerprint.

Next, compare requests. Copy the browser's request as cURL from the Network panel and run it. If that works and your script does not, add the missing headers one at a time until you find the one that matters. If even the copied cURL command fails, the TLS fingerprint is the likely cause, since curl connects differently from the browser.

Finally, look at rate. Many 403s appear only after a run has been going for a while. Log the time and the request count at the first 403. If it always appears after a similar number of requests, a rate based rule or score is involved, and slowing down will help more than anything else.

Keeping it legitimate

Most 403s you meet while collecting public data are side effects of protections aimed at abuse: credential stuffing, scalping, content theft at scale. Working with those protections, not against them, keeps your scraper stable: pass challenges where the site offers them, keep rates modest, identify consistently, and treat explicit blocks as the answer they are. Price monitoring, public catalog collection, research and QA of your own sites are the jobs this approach serves.

For the challenge case, the Cloudflare Challenge task returns a clearance for $0.84 per 1,000 solved tasks. Blocks never cost anything to diagnose, and the help article on HTTP 403 covers the non Cloudflare cases.

Common questions

How do I know if a 403 is a Cloudflare challenge?

Look for the cf-mitigated: challenge header and the Just a moment page. Without them, it is a block or an origin error.

Can a CAPTCHA solver fix every Cloudflare 403?

No. Only challenge 403s can be passed, with a clearance cookie. Firewall rule blocks are decisions by the site owner.

Why does my browser load the page while my script gets 403?

The script differs in headers, cookies or its TLS fingerprint. Compare the two requests to find the difference.

Do residential proxies stop 403 errors?

They can help with reputation based decisions, but they do not change explicit firewall rules or fix a mismatched client.

Is a 403 from the origin server different?

Yes. If the body looks like the site rather than a Cloudflare page, the site itself refused the request.

Keep reading