Anti-bot protection

How to bypass AWS WAF Bot Control when scraping public pages

Sites on AWS increasingly turn on AWS WAF's Bot Control and its challenge action. To a scraper it looks like a strange status code and a page full of JavaScript instead of the HTML it expected.

This guide shows how to recognise it and why the fix is mostly patience in a real browser.

Developer guide 8 min read

How to tell a site uses AWS WAF

AWS WAF's challenge is recognisable by its token cookie and integration script.

SignalWhereWhat it means
aws-waf-tokenCookieIssued once the challenge has been passed. Protected requests need it.
AwsWafIntegration / challenge.jsScriptThe challenge or CAPTCHA integration is running.
202 with a script pageStatus codeAWS WAF's default for a silent challenge: run the script, get a token, reload.
405 with a CAPTCHAStatus codeAWS WAF's default for its CAPTCHA action. Sites can change both codes.

How AWS WAF decides you are a bot

Bot Control labels requests from known bot signatures, IP reputation and, in its targeted mode, browser interrogation; the site's rules then allow, challenge, CAPTCHA or block.

Silent challenge

A script interrogates the browser and does a small proof-of-work, then sets aws-waf-token and reloads. No interaction needed.

CAPTCHA

A puzzle for visitors the rules consider risky.

Managed rule labels

Known automation user agents, hosting IP ranges and request-rate rules feed the decision.

What people try, and why it breaks

Plain HTTP clients

Breaks quickly

They receive the challenge page and cannot produce a token.

Treating the first status as final

Breaks quickly

The challenge answers with a non-200 by design (202 by default; one large property portal we tested served it as a 401). A tool that fails on that status never lets the script finish.

Real browser on a datacenter IP

Helps, not enough

Solves the challenge, but IP rules may still block.

What actually gets through

AWS WAF's challenge is meant to be passed by browsers. Give it a real one and a few seconds.

  1. 1

    Run it in a real browser

    The script sets aws-waf-token and reloads into the page on its own.

  2. 2

    Wait for the reload

    Do not judge the response by its first status code. Wait for the real document.

  3. 3

    Residential exits

    Clears the IP-reputation part of the managed rules.

Getting past AWS WAF with UnblockingAPI

Send the URL you want. You do not pick a proxy type, a browser or a "premium" mode: the API tries a fast plain fetch with a real Chrome TLS and HTTP/2 fingerprint first, and switches to a real browser on a residential exit when the answer is a block, a challenge or an empty shell. A request that fails is not charged.

curl -G "https://api.unblockingapi.com/unblock" \
  -H "X-Api-Key: $UNBLOCKINGAPI_KEY" \
  --data-urlencode "url=https://www.example.com/expose/123456" \
  --max-time 180
import os, requests

r = requests.get(
    "https://api.unblockingapi.com/unblock",
    params={"url": "https://www.example.com/expose/123456"},
    headers={"X-Api-Key": os.environ["UNBLOCKINGAPI_KEY"]},
    timeout=180,
)
result = r.json()

if result["status"] == "succeeded":
    print(result["http_response_code"], result["render_reason"])
    html = result["response"]   # the page itself, not the challenge
else:
    print("failed, not charged:", result.get("error"))

render_reason in the response says how the page was fetched: plain, fallback:challenge (the plain fetch hit a wall, so a browser took over), replay (a plain fetch carrying the session a browser earned earlier) and so on. What a site needs is learned per site, so the second request to a AWS WAF site goes straight to whatever worked.

What happens for AWS WAF specifically

  • —AWS WAF's challenge script is recognised in a blocking response and given time to reload into the page before the status is believed.
  • —The browser keeps the token for the rest of the session, so further pages on the same site go through without a new challenge.
  • —UnblockingAPI does not send CAPTCHAs to solving services. A visible, interactive check that has not passed within about eight seconds means that exit has been judged; the attempt is dropped and retried on a different exit, inside the same request.
Pages that fill in after load need a wait: wait_for with a CSS selector of the content, or scroll_steps for lists that grow as you scroll. See the API docs for every option.

When it still fails

No tool gets through every AWS WAF configuration every time, and anyone who promises 100% is guessing. The honest limits:

  • —Rules that always serve the CAPTCHA action for a path or region.
  • —Anything behind a sign-in. If a page needs an account, it is not a public page and is out of scope, both technically and under the Acceptable Use Policy.
  • —If every attempt inside the request's budget is blocked, you get status: "failed" and the request costs nothing. You only pay for pages that came back.

Responsible use

This guide is about reading public pages that a person can open in a browser without signing in. It is not about getting into accounts, skipping paywalls or overloading a site. Keep request rates reasonable, respect the law where you and the site operate, and follow the Acceptable Use Policy.

Frequently asked questions

202 is the default response code for AWS WAF's challenge action: the body is a script that verifies the browser, sets aws-waf-token and reloads into the real page. Plain HTTP clients stop at the 202.

Proof that this client passed AWS WAF's challenge or CAPTCHA. It is valid for a limited time and requests to protected paths need it.

Usually less strict by default; it depends on which managed rules and actions the site enabled. The silent challenge passes in a real browser if you give it time.

Try a AWS WAF-protected URL.

Test the fetching layer before building your parser. Start with 500 free credits and no credit card. See pricing for credits from €5, with no subscription.

One successful request is one credit. No multipliers for rendering, proxies or retries.

Rasmus Kjellberg

Rasmus Kjellberg

Founder & Developer at UnblockingAPI

Last updated November 2026