48 of 51 hard targets returned a real page in production. Read the run

Blog / HTTP

403 Forbidden: Why a Scraper Gets One and What Actually Fixes It

We audited every 403 in our production corpus. The browser fingerprint was almost never the cause — the exit address was. Here is how to tell which one you have.

Scrapengine Team//7 min read

403 Forbidden means the server understood who you are and is refusing anyway. That is what separates it from 401 Unauthorized, which means identify yourself first. A 401 invites a credential. A 403 says the credential — or the absence of one — is not the problem.

For anyone fetching pages programmatically, 403 is the status you will see most, and it is the one most often misdiagnosed. The usual reflex is to change the User-Agent string. That almost never works, and we have the numbers to say why.

What we found when we audited ours

We went through every failure in our production corpus and asked, for each one, what specifically refused the request. The result changed how we work:

  • Of the failures we had been counting as walls, fourteen were genuine — the rest were our own bugs, dormant configuration, or sites that were simply broken for everybody.
  • Of those fourteen, eleven were network-level. The refusal was about the address the request came from, not about the browser making it.
  • Two vendors — Cloudflare and Akamai — accounted for those eleven.

That ratio is the single most useful thing we know about 403s. The industry talks constantly about fingerprinting, canvas hashes and WebGL identity. In our own data, the fingerprint was almost never the deciding factor. Where the request came from was.

We tested this directly. Running our hardened browser against a fingerprinting test gave a bot score of 5 out of 100, against 71 for stock Chrome on the same connection — and the sites that were refusing us kept refusing us. A near-perfect fingerprint on a datacentre address is still a datacentre address.

Tip

Before you spend a week on fingerprint work, run the same request through a different exit address with everything else unchanged. If it succeeds, your problem was never the browser.

The five causes, in the order worth checking

1. The exit address

Datacentre IP ranges are published and widely blocked. Residential and mobile ranges are not. If every request from your AWS instance gets a 403 and the same request from your laptop does not, the cause is settled and no header will change it.

Reputation is also shared. If your provider resells an address that someone else has been hammering, you inherit the consequences.

2. Geographic policy

Plenty of 403s are regional. A retailer that serves one country will refuse addresses outside it, and will do so with a 403 rather than a redirect. The test is one request from inside the region.

3. TLS fingerprint

Before any header is sent, your client announces a cipher suite order and a set of TLS extensions. requests, curl and Go's stdlib each have a distinctive signature that does not match any browser. A server that compares the TLS handshake against the User-Agent string catches this instantly — you claimed to be Chrome and shook hands like Python.

This is the cause most people skip, because it is invisible at the HTTP layer.

4. Missing or inconsistent headers

Not the User-Agent on its own — the set. A real Chrome request sends Accept-Language, Sec-Fetch-Site, Sec-Fetch-Mode, Sec-Ch-Ua and others in a consistent arrangement. Sending a Chrome User-Agent with none of its companions is a louder signal than sending no User-Agent at all.

5. Actual authorisation

Sometimes a 403 means what it says: the resource requires a session you do not have. Check whether the page is visible in a logged-out browser before assuming you are being blocked as a bot.

Telling a real 403 from a disguised one

A complication: the status code lies in both directions. Some systems return a block page with 200 OK, and some return 403 for things that are not blocks at all.

This is why we inspect the body rather than trusting the status line. Our production guard reads the content of every 401, 403 and 429 before deciding whether the request was served or refused:

Python
import re
 
STRONG = re.compile(
    r"(access denied|you have been blocked|attention required|"
    r"cf-error-details|请求被拒绝|verify you are human)", re.I
)
WEAK = re.compile(r"(cookie|consent|privacy preferences)", re.I)
 
def is_block(status, body):
    if not body:
        return status in (401, 403, 429)
 
    # A strong marker is decisive regardless of status.
    if STRONG.search(body):
        return True
 
    # A short body on a refusal status is a block page.
    if status in (401, 403, 429) and len(body) < 2500:
        return True
 
    # A long body on a refusal status is usually real content
    # behind a partial paywall or a consent banner.
    return False

Splitting markers into strong and weak mattered more than we expected. An earlier version of this check scored served pages as blocked because they happened to contain the word "cookie" in a consent banner — the page was fine, the classifier was not. If you build one of these, keep the two tiers separate.

What actually fixes it

In order of how often it works, on our data:

Change the exit address. Eleven of fourteen. Start here, always. Rotating to a different country on a 403 is more effective than rotating within one, because geographic policy and address reputation are different mechanisms and the country switch tests both at once.

Match the TLS fingerprint to the claimed browser. Use a client that negotiates like the browser whose User-Agent you are sending. curl_cffi and similar libraries exist for exactly this.

Send a coherent header set. All of it or none of it. Derive Sec-Ch-Ua from the same browser version you claim in User-Agent; a mismatch between the two is a free giveaway.

Render the page. If the challenge requires executing JavaScript, no header arrangement will satisfy it.

Through our API that last pair is two parameters:

Shell
curl -X POST "https://api.scrapengine.io/api/v1/scrape" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/forbidden-page",
    "render": true,
    "country": "us"
  }'

Against 51 targets chosen because they were known to be hard, this returned a real page for 48. The other three came back named — with the wall that stopped them — rather than as empty successes. A 403 you can see is a problem you can work on; a 403 your pipeline swallowed is one you will find out about from a customer.

FAQ

Frequently asked questions

The server understood the request and is refusing to fulfil it. Unlike 401 Unauthorized, which asks you to identify yourself, a 403 means credentials are not the issue — the server has decided not to serve this request.

Keep reading

The pages you need are already refusing you

Start with a thousand pages. No proxy pool to rent, no browser fleet to run, and nothing billed for a wall we could not get through.