FlareSolverr: Bypass Cloudflare

Image Generated by MidJourney

Section 1: Introduction to FlareSolverr

Overview of Cloudflare's Anti-Bot Protection

Cloudflare provides a comprehensive suite of tools to protect websites from various online threats, including bots and DDoS attacks. One of its key features is the anti-bot protection system, which uses browser fingerprinting and JavaScript challenges to distinguish between legitimate users and automated scripts. When a request is made to a Cloudflare-protected website, the server may present a challenge that the requesting client must solve before accessing the site.

These challenges often involve complex JavaScript computations and browser behavior analysis, making it difficult for traditional web scrapers to bypass them. For web developers and data scientists who rely on scraping data from websites, Cloudflare's protections can be a significant obstacle.

Introduction to FlareSolverr and Its Purpose

FlareSolverr is a tool designed to help bypass Cloudflare's anti-bot protection. It acts as a proxy server that uses a headless browser to navigate through Cloudflare's challenges and retrieve the desired content. By leveraging Selenium with the undetected-chromedriver, FlareSolverr can mimic real browser behavior and solve JavaScript challenges presented by Cloudflare.

When a request is made through FlareSolverr, it launches a Chrome browser instance, opens the target URL, waits for the Cloudflare challenge to be solved, and then returns the HTML content and cookies to the user. These cookies can then be used with other HTTP clients like Python Requests to continue scraping the website without triggering additional challenges.

Key Features and Benefits of Using FlareSolverr

FlareSolverr offers several features that make it an effective solution for bypassing Cloudflare's protections:

1. Automated Challenge Solving

FlareSolverr automates the process of solving Cloudflare challenges using a headless browser. This allows users to focus on their scraping tasks without worrying about manual intervention or dealing with complex JavaScript challenges.

2. Easy Integration

FlareSolverr can be easily integrated with existing scraping scripts and tools. It provides a simple HTTP API that can be used to send requests and receive responses, making it compatible with various programming languages and libraries.

3. Session Management

FlareSolverr supports session management, allowing users to create, list, and destroy sessions. This feature is particularly useful for maintaining persistent cookies and user states across multiple requests, reducing the need to solve challenges repeatedly.

4. Docker Support

FlareSolverr is distributed as a Docker image, which simplifies the installation and setup process. Users can run FlareSolverr in a containerized environment, ensuring consistency and reducing dependency issues across different systems.

5. Open Source and Extensible

As an open-source project, FlareSolverr allows users to inspect, modify, and extend its codebase to suit their specific needs. This transparency ensures that users can adapt the tool to handle new types of challenges and stay ahead of updates to Cloudflare's protection mechanisms.

In the following sections, we will delve into the practical aspects of setting up and using FlareSolverr for web scraping. You'll learn how to install the necessary dependencies, run FlareSolverr, and integrate it with your scraping scripts to bypass Cloudflare protections effectively.

Section 2: Setting Up FlareSolverr

Installing Docker as a Prerequisite

Before you can use FlareSolverr, you need to have Docker installed on your system. Docker allows you to run applications in containers, which are isolated environments that ensure the software runs consistently across different systems. Below are the instructions for installing Docker on various operating systems.

Installation on Windows

To install Docker on Windows, follow these steps:

  1. Download the Docker Desktop installer from the official Docker website.
  2. Run the installer and follow the on-screen instructions.
  3. Once the installation is complete, restart your computer if prompted.
  4. After restarting, launch Docker Desktop from the Start menu and wait for it to initialize.

Installation on Mac OS X

To install Docker on Mac OS X, follow these steps:

  1. Download the Docker Desktop installer from the official Docker website.
  2. Open the downloaded .dmg file and drag the Docker icon to your Applications folder.
  3. Launch Docker from your Applications folder and follow the on-screen instructions to complete the installation.

Installation on Linux

To install Docker on Linux, follow these steps:

  1. Update your package index:
sudo apt-get update
  1. Install the necessary packages:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
  1. Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Add the Docker repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Install Docker:
sudo apt-get update && sudo apt-get install docker-ce
  1. Verify that Docker is installed correctly by running:
sudo docker run hello-world

Downloading and Running FlareSolverr

Pulling the Docker Image

Once Docker is installed, you can download the FlareSolverr Docker image. This image contains all the necessary components to run FlareSolverr.

To pull the FlareSolverr Docker image, run the following command in your terminal or command prompt:

docker pull flaresolverr/flaresolverr

Running the FlareSolverr Container

After pulling the Docker image, you can run the FlareSolverr container using the following command:

docker run -d \
  --name=flaresolverr \
  -p 8191:8191 \
  -e LOG_LEVEL=info \
  --restart unless-stopped \

This command runs the FlareSolverr container in detached mode, names it "flaresolverr", maps port 8191 on your host to port 8191 on the container, sets the log level to "info", and ensures the container restarts automatically unless stopped manually.

Verifying the Installation

To verify that FlareSolverr is running correctly, open your web browser and navigate to http://localhost:8191. You should see a response indicating that FlareSolverr is ready.

If you see a message like "FlareSolverr is ready!", you have successfully installed and started FlareSolverr. You can now proceed to use FlareSolverr for web scraping tasks.

Section 3: Using FlareSolverr for Web Scraping

Basic Usage with curl and Python Requests

FlareSolverr can be used with various tools and programming languages to bypass Cloudflare's protection. In this section, we'll cover how to make basic GET requests using curl and Python Requests.

Making GET Requests with FlareSolverr

FlareSolverr accepts HTTP requests and processes them using a headless browser. Here's how you can make a GET request to a Cloudflare-protected website:

Example Using curl

To make a GET request with curl, use the following command:

curl -L -X POST 'http://localhost:8191/v1' \
-H 'Content-Type: application/json' \
--data-raw '{
  "cmd": "request.get",
  "url": "http://www.website.com",
  "maxTimeout": 60000

This command sends a POST request to the FlareSolverr server running on localhost and instructs it to fetch the content from http://www.website.com. The maxTimeout parameter specifies the maximum time (in milliseconds) to wait for the Cloudflare challenge to be solved.

Example Using Python Requests

To make a GET request using Python Requests, use the following script:

import requests

url = "http://localhost:8191/v1"
headers = {"Content-Type": "application/json"}
data = {
    "cmd": "request.get",
    "url": "http://www.website.com",
    "maxTimeout": 60000

response = requests.post(url, headers=headers, json=data)

This script sends a POST request to the FlareSolverr server and prints the response, which contains the HTML content and cookies needed to bypass Cloudflare.

Advanced Usage

Retrieving Cloudflare Cookies

To use the cookies retrieved by FlareSolverr with another HTTP client, you need to extract the cookies from the response and include them in subsequent requests. Here’s how to do it with Python Requests:

import requests

post_body = {
    "cmd": "request.get",
    "url": "http://www.website.com",
    "maxTimeout": 60000

response = requests.post('http://localhost:8191/v1', headers={'Content-Type': 'application/json'}, json=post_body)

if response.status_code == 200:
    json_response = response.json()
    if json_response.get('status') == 'ok':
        cookies = json_response['solution']['cookies']
        clean_cookies_dict = {cookie['name']: cookie['value'] for cookie in cookies}
        user_agent = json_response['solution']['userAgent']

        headers = {"User-Agent": user_agent}
        response = requests.get("http://www.website.com", headers=headers, cookies=clean_cookies_dict)
        if response.status_code == 200:

This script retrieves the cookies from FlareSolverr and uses them to make a GET request directly with Python Requests, bypassing Cloudflare's protections.

Managing Sessions with FlareSolverr

FlareSolverr supports session management, which allows you to maintain persistent cookies and user states across multiple requests. This is useful for reducing the number of times you need to solve Cloudflare challenges.

Creating a Session

To create a session, set the cmd field to sessions.create:

import requests

url = "http://localhost:8191/v1"
headers = {"Content-Type": "application/json"}
data = {
    "cmd": "sessions.create",
    "url": "http://www.website.com",
    "maxTimeout": 60000

response = requests.post(url, headers=headers, json=data)

This command creates a new session for the specified URL.

Listing Sessions

To list active sessions, set the cmd field to sessions.list:

curl -L -X POST 'http://localhost:8191/v1' \
-H 'Content-Type: application/json' \
--data-raw '{
    "cmd": "sessions.list",
    "maxTimeout": 60000
Destroying a Session

To destroy a session, set the cmd field to sessions.destroy and provide the session ID:

curl -L -X POST 'http://localhost:8191/v1' \
-H 'Content-Type: application/json' \
--data-raw '{
    "cmd": "sessions.destroy",
    "session": "session_ID",
    "maxTimeout": 60000

Managing sessions can help optimize your scraping workflow by minimizing the frequency of Cloudflare challenges.

Making POST Requests with FlareSolverr

In addition to GET requests, FlareSolverr can also handle POST requests, which are useful for submitting forms or interacting with APIs on Cloudflare-protected websites.

import requests

post_body = {
    "cmd": "request.post",
    "postData": "param1=value1¶m2=value2",
    "maxTimeout": 60000

response = requests.post('http://localhost:8191/v1', headers={'Content-Type': 'application/json'}, json=post_body)

This script makes a POST request to the specified URL, submitting the provided form data and returning the server's response.

With these examples and techniques, you should be able to effectively use FlareSolverr to bypass Cloudflare's anti-bot protections and scrape data from protected websites.

Section 4: Optimizing and Troubleshooting

Best Practices for Using FlareSolverr

Memory Management and Resource Allocation

FlareSolverr utilizes a headless browser to solve Cloudflare's challenges, which can consume a significant amount of memory. To optimize resource usage and ensure smooth operation, consider the following tips:

  • Limit Concurrent Requests: Avoid making too many simultaneous requests. Each request launches a new browser instance, which can quickly consume available memory. Manage the concurrency of your requests to balance load and performance.
  • Use Session Management: Sessions can help reduce the number of browser instances needed. By reusing sessions, you can maintain persistent cookies and user states, minimizing the overhead of solving Cloudflare challenges repeatedly.
  • Monitor Resource Usage: Regularly monitor your system's CPU and memory usage. Adjust the number of concurrent requests and session configurations based on the available resources.

Session Management Tips

Effective session management is crucial for optimizing your scraping tasks. Here are some best practices for managing sessions with FlareSolverr:

  • Create and Reuse Sessions: Create sessions for each unique scraping task or user scenario. Reuse these sessions for subsequent requests to maintain continuity and reduce the need for solving Cloudflare challenges repeatedly.
  • Destroy Unused Sessions: Ensure that you destroy sessions that are no longer needed. Keeping unused sessions active can consume unnecessary resources and may lead to session conflicts.
  • Use Unique Session IDs: When creating sessions, use unique and descriptive session IDs to avoid confusion and ensure easy identification of active sessions.

Common Issues and Troubleshooting

Handling Cloudflare Updates and Changes

Cloudflare frequently updates its anti-bot protection mechanisms, which can impact the effectiveness of tools like FlareSolverr. Here are some strategies to handle these updates:

  • Stay Updated: Regularly check for updates to FlareSolverr and related dependencies. The FlareSolverr community and developers often release updates to address changes in Cloudflare's protection mechanisms.
  • Monitor Changes: Monitor the behavior of your scraping scripts. If you notice an increase in failed requests or new challenges, investigate and adapt your approach accordingly.
  • Community Support: Engage with the FlareSolverr community through forums, GitHub issues, and other channels. Sharing experiences and solutions can help you stay ahead of Cloudflare's updates.

Dealing with Performance Issues

If you encounter performance issues while using FlareSolverr, consider the following troubleshooting steps:

  • Check Resource Usage: Monitor your system's CPU, memory, and network usage. High resource consumption can impact performance. Adjust your request concurrency and session configurations as needed.
  • Optimize Requests: Simplify your requests by reducing unnecessary parameters and data. Streamlining your requests can improve response times and reduce resource consumption.
  • Use Proxies: If you are scraping from multiple IP addresses, consider using proxies to distribute the load. This can help avoid IP blocking and improve the overall performance of your scraping tasks.


By understanding these best practices, troubleshooting common issues, and exploring alternative tools, you can optimize your use of FlareSolverr and enhance your web scraping capabilities.

 Whether you're dealing with Cloudflare's anti-bot protections or looking for other solutions, these insights will help you achieve more efficient and reliable scraping results.


FlareSolverr is a powerful tool for bypassing Cloudflare's anti-bot protections, enabling users to scrape data from Cloudflare-protected websites effectively. By leveraging a headless browser to solve complex JavaScript challenges, FlareSolverr simplifies the process of accessing protected content and managing session cookies.

In this article, we have covered the essential aspects of using FlareSolverr, including installation, basic and advanced usage, and optimization techniques. By following the best practices for memory management, session handling, and troubleshooting, you can ensure a smooth and efficient scraping workflow.

While FlareSolverr provides a robust solution for many scraping tasks, it is essential to stay updated with the latest developments and consider alternative tools and services when necessary. Each tool has its unique strengths and can complement your scraping strategy, helping you navigate the evolving landscape of web scraping and anti-bot protections.

With the knowledge and techniques shared in this article, you are now equipped to harness the full potential of FlareSolverr and enhance your web scraping capabilities. Whether you are a developer, data scientist, or researcher, FlareSolverr can be a valuable asset in your toolkit, enabling you to gather the data you need from Cloudflare-protected websites efficiently and reliably.

Happy scraping!

By using this website, you accept our Cookie Policy.