logo

WAF & Anti-Bot Bypass

View as Markdown

Getting blocked while web scraping? Scrape.do bypasses WAFs and anti-bot systems such as Cloudflare, DataDome, Akamai, PerimeterX and Imperva for you, on normal requests, without you having to turn on a headless browser.

This page explains what Scrape.do does with your request, what you are charged, how to measure your success rate on a domain, and what to do when requests still fail.

How Scrape.do handles a request to a protected site: it sends the request through a proxy, checks the response for a block, retries on a new IP or runs a browser step in the background when needed, and returns the real page, or an uncharged 502 when every attempt fails.

When every retry is blocked or fails, Scrape.do returns a 502 that is never charged. Retrying the same failing request in an endless loop can get all your requests to that domain throttled. See Don't retry failures in an endless loop.


How Scrape.do keeps you from getting blocked

How Scrape.do keeps requests unblocked: automatic retries on a new IP each try, WAF bypass with no render=true needed, and ongoing work on our side, so you need no code changes when a protection changes.

Every request goes through these stages automatically. You don't need to turn any of them on.

1. Automatic retries

If an attempt is blocked or returns an invalid page, we send it again through a different proxy. This repeats until a valid response comes back or the request timeout (60 seconds by default) runs out. You only receive the final result. See Retry Settings to change this behavior.

2. WAF bypass

Scrape.do's anti-bot bypass gets past WAFs and anti-bot systems on normal requests. When getting past a protection needs a real browser, we run that browser step in the background as part of WAF bypass, so you don't need to send render=true for it. WAF bypass adds no fee of its own; see What you are charged.

WAF bypass covers:

  • Cloudflare
  • DataDome
  • Akamai Bot Manager
  • PerimeterX (HUMAN)
  • Imperva (Incapsula)
  • Kasada, F5 (Shape) and AWS WAF
  • Other WAFs and anti-bot systems: most are handled the same way. If one isn't, contact support and we add it.

Protections change over time. When one changes, we update WAF bypass on our side, so you don't need to change your code.

How it works for you:

  1. Detect. Every response is checked for block and challenge pages from WAFs and anti-bot systems. A detected block never counts as a success: we retry it, and it isn't charged.
  2. Solve. JavaScript challenges, sensor checks and captchas are handled automatically (see CAPTCHA Handling). When a site lets visitors in only after a real browser passes its check, we pass that check once in the background and reuse the access for your next requests to the site.
  3. Deliver. You get the real page as a normal response, charged like any other request to that site.

Good to know:

  • The first requests to a newly protected site can take longer, or fail, while we solve it. After that, requests to the site use the solution from the first attempt.
  • WAF bypass runs on the proxy network your request uses. With super=true it uses residential & mobile IPs, which the strictest sites expect.
  • If you send your own headers or cookies (customHeaders, extraHeaders, forwardHeaders or setCookies), the background browser step is skipped.
  • The Scrape.do-Detected-Waf response header shows which protection we saw on the site, for example CLOUDFLARE, DATADOME, or AKAMAI,PERIMETERX when there are several.

More on this: Anti-Bot Bypass, CAPTCHA Handling. For how anti-bot systems detect scrapers in general, see how big websites prevent web scraping.

3. Ongoing work on our side

Our team works in the background to keep requests to protected sites succeeding, so you don't need to change your parameters or your code when a site changes its protection.

We also check the domains on every account proactively. When we see a problem, we keep your account healthy, either by helping you with your configuration or by fixing it automatically on our side.


What you are charged

WAF bypass adds no fee of its own. A successful request costs what any request with the same parameters costs:

RequestCredits
Default (datacenter proxy)1
render=true5
super=true10
super=true and render=true25

Some domains have their own rate or a default proxy or render profile, as listed in Request Costs. The Scrape.do-Request-Cost response header shows the exact cost of each request.

You are not charged for:

  • blocked attempts and the retries after them,
  • the background browser step of WAF bypass,
  • the final 502 when every attempt fails,
  • a 400 that asks you to add super=true.

Whether a response from the target site itself is charged, for example a 404, depends on its status code, as listed in Status Codes.


Measure your success rate correctly

Judge a domain by its success rate, not by single requests:

  • Measure each domain separately.
  • Send at least 500–1,000 requests to the domain before you judge it.
  • Send them concurrently, up to the concurrency limit of your plan, not one at a time.
  • Don't judge by a few requests sent by hand. They are misleading whether they succeed or fail.

If your success rate on a domain is below 90%, there is very likely a problem. Contact support and we'll look into it.


What to do when a request fails

What to do with a failed request: a 400 that says the domain requires super=true means resend with super=true; a 502 that suggests super=true means add it; a 502 that says failures are transient, or that you already use super=true, means retry without changes; a 200 that returns a bot check page means contact support.

1. Read the failed response

When every retry is blocked or fails, you get HTTP 502 with a JSON body that explains what happened. This 502 isn't charged:

{
  "URL": "https://www.g2.com/",
  "StatusCode": 403,
  "ErrorCode": 90,
  "ErrorType": "BLOCKED_BY_WAF(DATADOME)",
  "Message": [
    "Blocked by DATADOME. Failures on this domain are usually transient — retry the request.",
    "Request failed and not charged. Please try again."
  ],
  "Contact": "If this error keeps repeating and your success rate on this domain stays low over time, contact support@scrape.do"
}
FieldWhat it tells you
StatusCodeThe status of the last attempt: often the code the target site returned (such as 403), or 502 when the attempt got no usable answer, for example after a timeout.
ErrorCodeA numeric code for the error. Branch on ErrorType instead.
ErrorTypeBLOCKED_BY_WAF(<NAME>) when the site's anti-bot protection blocked the request, for example BLOCKED_BY_WAF(DATADOME), otherwise ROTATION_FAILED. Safe to branch on in your code.
MessageWhat went wrong. The first line can carry a hint, such as "Blocked by DATADOME." followed by what to do.
PossibleCausesThe parameter change most likely to help. When it is missing, no parameter change helps: retry the request.

Other errors, such as invalid parameters (400), account or credit problems (401) and concurrency limits (429), use other status codes. They are listed in Status Codes.

What the message means for you:

  • "Try super=true…": go to step 2.
  • "This domain requires super=true…" (status 400, not charged): send the request again with super=true.
  • "Failures on this domain are usually transient…": we are already handling this site on our side. Retry, and don't change your parameters.
  • "You're already using super=true. Occasional failures on protected domains are expected.": retry the request.

2. Use the super network: super=true

By default, requests go out through datacenter proxies. With super=true, the request goes through our residential & mobile network of 150M+ IPs, which the strictest sites expect.

  • A successful request costs 10 credits (25 with render=true), unless the domain has its own rate in Request Costs. Failed attempts are free.
  • Retries and WAF bypass also run on residential & mobile IPs.
  • Without geoCode, the exit country of a super request can vary. Set geoCode when the country matters.
  • Use it when PossibleCauses suggests it. If you already send it, the failed response says so, and the next step is to retry.

See Super (Residential & Mobile) for details.

curl --location --request GET 'https://api.scrape.do/?token=YOUR_TOKEN&url=https://httpbin.co/anything&super=true'
import requests
import urllib.parse
token = "YOUR_TOKEN"
targetUrl = urllib.parse.quote("https://httpbin.co/anything")
superParam = "true"
url = "https://api.scrape.do/?token={}&url={}&super={}".format(token, targetUrl,superParam)
response = requests.request("GET", url)
print(response.text)
const axios = require('axios');
const token = "YOUR_TOKEN";
const targetUrl = encodeURIComponent("https://httpbin.co/anything");
const superParam = "true";
const config = {
    'method': 'GET',
    'url': `https://api.scrape.do/?token=${token}&url=${targetUrl}&super=${superParam}`,
    'headers': {}
};
axios(config)
    .then(function (response) {
        console.log(response.data);
    })
    .catch(function (error) {
        console.log(error);
    });
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
)

func main() {
	token := "YOUR_TOKEN"
	encoded_url := url.QueryEscape("https://httpbin.co/anything")
	url := fmt.Sprintf("https://api.scrape.do/?token=%s&url=%s&super=true", token, encoded_url)
	method := "GET"
	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)
	if err != nil {
		fmt.Println(err)
		return
	}
	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
require "uri"
require "net/http"
require 'cgi'
str =  CGI.escape "https://httpbin.co/anything"
url = URI("https://api.scrape.do/?url=" + str + "&token=YOUR_TOKEN&super=true")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;

public class TestRequest {
    public static void main(String[] args) throws Exception {
        String token = "YOUR_TOKEN";
        String targetUrl = URLEncoder.encode("https://httpbin.co/anything", StandardCharsets.UTF_8);
        String url = "https://api.scrape.do/?token=" + token + "&url=" + targetUrl + "&super=true";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder(URI.create(url))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
using System.Net;
string token = "YOUR_TOKEN";
string url = WebUtility.UrlEncode("https://httpbin.co/anything");
var client = new HttpClient();
var requestURL = $"https://api.scrape.do/?token={token}&url={url}&super=true";
var request = new HttpRequestMessage(HttpMethod.Get, requestURL);
var response = client.SendAsync(request).Result;
var content = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(content);
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = [
   "url" => "https://httpbin.co/anything",
   "token" => "YOUR_TOKEN",
   "super" => "true"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_URL, "https://api.scrape.do/?".http_build_query($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    "Accept: */*",
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>

3. Send the request from the right country: geoCode

If a site serves only some countries, or shows each country different content, set geoCode to the country the site serves, for example geoCode=de for a German store. With super=true you can also use regionalGeoCode to pick a random country in a region. See Geo Targeting and Regional Geo Targeting.

4. If the page loads but your data is missing: render=true

The headless browser is not a fix for blocks; WAF bypass already handles them, including any browser step a site needs. On most protected sites it doesn't help, and it skips the background browser step of WAF bypass. Use it when the request succeeds but the content you need is loaded by JavaScript after the page opens. If the page you get is a bot check instead of the real page, go to step 5.

  • render=true opens the page in a real browser (5 credits, 25 with super=true).
  • waitSelector waits until the element you need appears, for example waitSelector=.price.
  • customWait waits a fixed time in milliseconds after the page loads. Use it only when there is no element to wait for.

5. Contact support

Contact us at support@scrape.do, or through live support if your plan includes it, in either of these cases:

  • The request succeeds, but the page is a bot check. You get 200, but the content is a captcha, a "verify you are human" page or a similar check instead of the real page. We can add a rule for that site so these pages count as failed requests, which are retried and not charged.
  • Your success rate on a domain is below 90%, measured as described in Measure your success rate correctly.

Send us the request exactly as you made it to Scrape.do:

  • the target web page: the full URL you asked Scrape.do to fetch,
  • your Scrape.do configuration for that request: every parameter you send (such as super, geoCode or render) and any headers or cookies you pass,
  • a few Scrape.do-Request-Id response header values from the affected requests,
  • roughly when it started.

Don't retry failures in an endless loop

When a large share of your requests to a domain keeps failing, Scrape.do may start throttling your requests to that domain for a while. Heavy failing traffic can make a site harder to reach for the parts that work too, and the throttle prevents that.

For example, example.com/path_XX fails but example.com/path_YY works. If you keep sending heavy traffic to path_XX and retry every 502 in an endless loop, your failure rate on example.com rises. Then your requests to the whole domain are throttled, including path_YY. While the throttle is on, requests to that domain fail with 502 and aren't charged. The throttle lifts on its own after a while, and it lasts longer each time it happens again.

To avoid it:

  • limit how many times you retry the same URL, and wait longer between retries,
  • if a page keeps failing, stop sending it and contact support.

We also watch for this proactively, as described in Ongoing work on our side.


Things that make blocks more likely

  • Your own headers or cookies. They change the request we would otherwise send, and they skip the background browser step of WAF bypass. Send them only when the site needs them.
  • render=true on a site that doesn't need it. It is slower, costs more and skips the background browser step of WAF bypass.
  • disableRetry=true, or a short timeout / retryTimeout. These leave fewer or no retries before the request gives up.
  • Retrying failed requests in an endless loop. It can get all your requests to that domain throttled.

On this page