Errors & CAPTCHAs

403 Forbidden when scraping: why the site said no, and the fix

HTTP status codes · 403
Published · Updated

What you see

  • 403 Forbidden
  • HTTP/1.1 403 Forbidden
  • HTTP Error 403: Forbidden
  • 403 Client Error: Forbidden for url
More error strings (3)
  • Request failed with status code 403
  • The requested URL returned error: 403
  • API Error: 403 Attention Required! | Cloudflare

What it means

403 Forbidden (Python Requests: 403 Client Error: Forbidden for url) means the server got your request and understood it. It decided you may not have this page. Sending the exact same request again will get the same 403.

What we measured: 35 of 100 sites sent a 403

We asked 100 well-known sites for one page each from a datacenter IP (probe run 2353, 25 Nov 2026, 23:53 UTC). 35 answered 403. Who sent it, from its headers, cookies and page we got back:

who sent the 403 sites
DataDome 10
Akamai 10
Cloudflare 9
AWS WAF 1
HUMAN (PerimeterX) 1
no shield we could name 4

We retried those 35 sites on 26 Nov 2026. “Opened” means the page held the content our check looked for.

what we tried opened (of 35)
the same plain request from a residential IP (runs 0129-oxy-resi, 0129-bd-resi) 15
a real browser on a residential IP, for the rest (patchright 3 tries, camoufox 3) 10 more
nothing we tried 10

Closed to everything we tried: lowes.com, seatgeek.com, apartments.com, g2.com, yelp.com, ebay.com, trivago.com, tickpick.com, ziprecruiter.com and reddit.com.

Beware a fake pass. For 10 of the 20 sites still closed to a residential IP, the 403 turned into a 200 that still wasn’t the page, such as Akamai’s challenge or Reddit’s “Prove your humanity”.

Which tool types get past it: residential proxies first (prices below), then a real browser (browser automation) on top. Scraper and unblocker APIs bundle both; we have not measured them here yet. In our proxy benchmark (run scrapenews-proxy-benchmark-2026-11-26, 26 Nov 2026), G2 loaded 0 of 100 requests across 5 setups, residential ones included.

Free tools against the walls that send these 403s (all sites; open-source benchmark, run scrapenews-open-source-benchmark-2026-11-26, 26 Nov 2026). Top on DataDome sites: Camoufox, nodriver, Botasaurus, curl_cffi, curl-impersonate and 2 more tie (18–36%). Top on Akamai Bot Manager sites: Camoufox, Botasaurus, nodriver, Patchright, Scrapling StealthyFetcher and 4 more tie (43–59%).

Residential proxies: price for 10 GB a month, cheapest first
Vendor, plan it picksTotal a month$/GBTotal a yearFree trial · note · source
HProxy Residential ProxiesLite: 10 GB$4.70$0.47$56.40hproxy.com · 29 Nov 2026
CakeIP10GB$6.00$0.60$72promo pricecakeip.com · 29 Nov 2026
Geonode Residential Proxies10 GB Plan$7.92$0.79$95.04free trial: $5 = 10 GB for 3 daysgeonode.com · 29 Nov 2026
ProxyBase Residential ProxiesPay as you go$8.50$0.85$102proxybase.org · 29 Nov 2026

List prices from each vendor’s pricing page, US dollars before tax, live from our price data. Your own size, in the price calculator: Residential proxies.

Why it happens

Only the final reason below is about passwords. The rest are about how your request looks or where it comes from.

  1. Your request doesn’t look like a browser. A browser sends cookies, a Referer (the page you came from) and a browser User-Agent (the name tag of your client). Scripts often don’t. Python Requests calls itself python-requests/<version> by default, and some sites reject any name that mentions curl or Wget.
  2. A bot shield blocked you. On Cloudflare sites, that 403 can come from WAF rules (the site’s firewall rules), the Security Level setting, the Browser Integrity Check, DDoS protection, or most of the 1xxx errors, like 1020 “Access denied”.
  3. Your IP address is on a block list. Servers can deny whole IP blocks.
  4. Your connection itself can betray you. Before any page loads, your program and the server shake hands (the TLS handshake). Most HTTP libraries shake hands differently from Chrome or Firefox, and some sites use that to spot them.
  5. The site’s own rules. Without Cloudflare, this is often a permission rule (like an Apache .htaccess file) or a ModSecurity rule.
  6. You really lack access. You are logged in, but your login or token isn’t allowed to see this page.

Why can a missing header cost you the page? Cloudflare’s Browser Integrity Check is on by default, and it looks for HTTP headers that spammers often abuse. It also challenges visitors with no User-Agent, or one that looks like a bot’s. So a bare script can fail before any smarter check even runs.

The Security Level setting is now mostly the switch for Under Attack mode. Flip it on and every visitor gets a challenge page first.

The handshake problem sits one layer lower. The first message your client sends is called the Client Hello. Most libraries send one that looks nothing like a real browser’s, and their HTTP/2 settings are different too. No header you add can hide that.

One more point: a 403 is not always a final no. Cloudflare also uses it for challenge pages, the “prove you’re a browser” step.

Fix it

  1. Read the response before changing anything. The server may say why in the body: a Cloudflare-branded page (often with a Ray ID) means Cloudflare blocked you. No branding means the site’s own server sent it.
  2. Don’t loop on retries. A repeated request gets the same answer. Change one thing, then try again.
  3. Send what your browser sends. Open the page in your browser, open developer tools, Network tab and copy the request headers. Start with User-Agent, Cookie and Referer.
  4. Check your login: if the page needs an account, send fresh, valid cookies or a token that has access to it.
  5. Match a browser at the handshake as well. Libraries like curl_cffi and curl-impersonate copy the TLS and HTTP/2 handshake of real browsers. curl_cffi’s own advice: try it if a site blocks you “for no obvious reason”.
  6. Test from another IP. Same request, different network or proxy. If that one works, the block is on your IP or its range. A residential IP opened 15 of our 35.
  7. Use a real browser on that IP (Playwright or a stealth build like patchright or camoufox). That got 10 more of ours open.
  8. Still stuck on a site that fights back? An unblocker API does the work for you. Bright Data Web Unlocker and Oxylabs Web Unblocker both handle proxy choice, browser fingerprints and retries on their side.

If this is your own Cloudflare site, look in the Security Events log for the Ray ID or the visitor’s IP. It shows which rule blocked the request.

The order matters. The first steps cost nothing. The last ones cost money, so change one thing per test so you know which fix worked.

Why do browser headers help? They make your request match what the site sees when real visitors arrive. A missing cookie alone can get you refused, especially when the site hands it out after a check.

Here is how Cloudflare does it. A small script runs in the browser on HTML pages. If it passes, Cloudflare gives the visitor a cf_clearance cookie. The site’s rules then read that cookie to let the request pass, block it or challenge it. A plain HTTP client never runs that script, so it never earns that cookie.

That is where unblockers come in. Oxylabs Web Unblocker renders JavaScript, keeps sessions and reuses cookies. Bright Data Web Unlocker solves CAPTCHAs and charges only for requests that succeed.

Paste this into your AI

My scraper gets this error: "<paste the exact error line>".
Explain in plain words what a 403 means.
Then list the likely causes in order, most likely first.
For each cause, give one quick test and one fix.
Tell me how to see if Cloudflare or the site's own server sent it.
My setup: <language + library>, <the URL pattern>, <the request headers I send>,
<proxy or no proxy>, <does the same URL open in my browser: yes/no>.
Start of the response body: <paste the first 20 lines>.

Dev details

The status code line:

HTTP/1.1 403 Forbidden

What each library prints:

client message
Python Requests (raise_for_status()) 403 Client Error: Forbidden for url: <url>
Python urllib HTTP Error 403: Forbidden
Axios Request failed with status code 403
curl with -f / --fail exits with code 22 and prints no body

curl --fail hides the body, but that body is often the clue. Leave --fail off while you debug and look at headers and body:

curl -i 'https://example.com/page'

Learn to tell a Cloudflare challenge from a plain block. Every Cloudflare challenge page carries the cf-mitigated header, and challenge is its only value:

import requests

r = requests.get(url, headers=headers, timeout=30)
if r.status_code == 403:
    if r.headers.get("cf-mitigated") == "challenge":
        print("Cloudflare challenge page")
    print(r.text[:500])  # the server may explain the reason here

Edge cases:

  • 404 instead of 403. The spec allows a server to answer 404 (Not Found) to hide that a page exists. A “missing” page could really be a forbidden one.
  • Cloudflare 1020. Cloudflare sends error 1020 with HTTP status 403 when a security rule set to Block matches and has no custom response. WAF custom or managed rule blocks get the WAF block page instead of 1020. The ones we got were titled Attention Required! | Cloudflare (1020 page).
  • A login error that isn’t. On 13 Nov 2026, a Claude Code user reported Please run /login · API Error: 403 Attention Required! | Cloudflare. A commenter on the issue says the same stored login worked a minute later: the 403 came from Cloudflare’s edge, not the login check. Read that body before you log in again.
  • A bare Cloudflare 403. If the host you ask for doesn’t match the SNI (the hostname your client names during the TLS handshake), Cloudflare returns a bare 403 page, and the site owner can’t see it in their logs: it happens before their settings load.
  • Credentials: if you sent credentials, the server thinks they aren’t good enough. Don’t resend the same ones automatically. New or different credentials may work.

How to read this in code: treat a 403 as “stop and change something”, not as “try again”. The spec says a client should not resend a refused request with the same credentials. Retrying the same request in a loop just gets the same answer.

Log 3 details for every 403: the response headers, the start of the body and the IP or proxy you used.

  • cf-mitigated: challenge present means a Cloudflare challenge page. You need a client that can run JavaScript.
  • Cloudflare branding, no cf-mitigated: a block, not a challenge. Change how you appear or where you come from.
  • No Cloudflare branding: the host’s own server refused you. Think permission rules, ModSecurity or IP deny rules.

Why the 1020 detail matters: a 1020 means a specific Block rule matched. Only the site’s owner can change it. Cloudflare’s advice to visitors: send the owner a screenshot of the error.

Questions

Why do curl and wget get 403 when the same page opens in my browser?

Your browser sends more than your script does: cookies, a Referer and a browser User-Agent. Some sites reject User-Agents that don't start with Mozilla or that contain curl or Wget. Copy the headers your browser sends (developer tools, Network tab) and send the same ones.

What is the difference between 401 and 403?

401 means the server wants you to log in. 403 means logging in again makes no difference: the server understood the request and still refuses it.

scrapenews difficulty

Not scored. We have 2 of 8 factors; a score needs 3.

FactorWhat we foundSource
Smallest client that gets througha plain HTTP clientscrapfly.io
Checks stackedheader and HTTP/2 fingerprint, IP reputation, TLS fingerprint, device and cookie historyscrapfly.io

Our analysis of 2 sourced facts; measured runs replace them as they come. How we rate difficulty

Tools that get past it

ToolPrice
Bright Data Web Unlocker: Unblocking API from Bright Data: you send a URL, it handles proxies, retries and CAPTCHAs. Billed per 1,000 requests.$1.50/1k req
Camoufox: Anti-detect browser built on Firefox that changes fingerprints to look like a real user; works with Playwright.Free
curl_cffi: Python HTTP client on curl-impersonate that can copy a browser's TLS, JA3 and HTTP/2 fingerprints.Free
curl-impersonate: Special build of curl that looks like Chrome or Firefox at the TLS and HTTP/2 level.Free
Oxylabs Web Unblocker: Oxylabs proxy-style endpoint that handles blocks for you, billed per GB of traffic.$7.20/GB
Patchright: Drop-in patched version of Playwright that hides common automation signs.Free

Sources

  1. RFC 9110 §15.5.4: 403 Forbidden rfc-editor.org
  2. MDN: 403 Forbidden developer.mozilla.org
  3. Cloudflare Docs: Error 403 developers.cloudflare.com
  4. Cloudflare Docs: Error 1020 developers.cloudflare.com
  5. Cloudflare Docs: Detect a Challenge Page response developers.cloudflare.com
  6. Cloudflare Docs: Browser Integrity Check developers.cloudflare.com
  7. Cloudflare Docs: Security Level developers.cloudflare.com
  8. Cloudflare Docs: JavaScript Detections (cf_clearance) developers.cloudflare.com
  9. Unix & Linux Stack Exchange: why would curl and wget result in a 403 forbidden? unix.stackexchange.com
  10. Stack Overflow: CURL error: The requested URL returned error: 403 stackoverflow.com
  11. curl-impersonate: README (TLS and HTTP/2 fingerprints) github.com
  12. curl_cffi: README github.com
  13. Requests source: raise_for_status() message github.com
  14. Requests source: default_user_agent() github.com
  15. Axios source: settle.js error message github.com
  16. CPython source: urllib HTTPError message github.com
  17. curl man page: --fail curl.se
  18. Bright Data Docs: Web Unlocker API overview docs.brightdata.com
  19. Oxylabs Docs: Web Unblocker developers.oxylabs.io
  20. Claude Code issue #109521: API Error: 403 Attention Required! | Cloudflare (13 Nov 2026) github.com