Portainer Templates logo

Portainer Templates

FlareSolverr FlareSolverr

Container

OtherTools

FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.

Image details

Architecture: amd64, arm64, arm/v7, 386
Image size: 269 MB
User: flaresolverr

Source details

Stars: 15.2k
Forks: 1k
Language: Python
License: MIT
Updated: 1 month ago

Configuration

Type
Container
Platform
linux
Image
ghcr.io/flaresolverr/flaresolverr:latest
Ports
8191:8191/tcp
Env vars
LOG_LEVEL=infoLOG_HTML=falseCAPTCHA_SOLVER=noneTZ=America/New_York
Restart
unless-stopped

Template by novaspirit

Notes

Template created by Pi-Hosted Series
Check our Github page: https://github.com/pi-hosted/pi-hosted

Official Docker Documentation: https://github.com/FlareSolverr/FlareSolverr#installation


Standalone Install

Select an install method, to see config/commands for deploying FlareSolverr

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select FlareSolverr, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo

More install options in our documentation, or see flaresolverr/flaresolverr for app-specific guidance.

FlareSolverr

Latest release Docker Pulls Docker Stars GitHub issues GitHub pull requests GitHub Repo stars
ko-fi
FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.

How it works

FlareSolverr starts a proxy server, and it waits for user requests in an idle state using few resources. When some request arrives, it uses Selenium with the undetected-chromedriver to create a web browser (Chrome). It opens the URL with user parameters and waits until the Cloudflare challenge is solved (or timeout). The HTML code and the cookies are sent back to the user, and those cookies can be used to bypass Cloudflare using other HTTP clients.
NOTE: Web browsers consume a lot of memory. If you are running FlareSolverr on a machine with few RAM, do not make many requests at once. With each request a new browser is launched.
It is also possible to use a permanent session. However, if you use sessions, you should make sure to close them as soon as you are done using them.

Installation

Docker

It is recommended to install using a Docker container because the project depends on an external browser that is already included within the image.
Docker images are available in:
  • GitHub Registry => https://github.com/orgs/FlareSolverr/packages/container/package/flaresolverr
  • DockerHub => https://hub.docker.com/r/flaresolverr/flaresolverr

Supported architectures are:
ArchitectureTag
x86linux/386
x86-64linux/amd64
ARM32linux/arm/v7
ARM64linux/arm64

We provide a docker-compose.yml configuration file. Clone this repository and execute docker-compose up -d (Compose V1) or docker compose up -d (Compose V2) to start the container.
If you prefer the docker cli execute the following command:
Bash
docker run -d \
  --name=flaresolverr \
  -p 127.0.0.1:8191:8191 \
  -e LOG_LEVEL=info \
  --restart unless-stopped \
  ghcr.io/flaresolverr/flaresolverr:latest

Command Prompt or Powershell
docker run -d --name=flaresolverr -p 127.0.0.1:8191:8191 -e LOG_LEVEL=info --restart unless-stopped ghcr.io/flaresolverr/flaresolverr:latest

If your host OS is Debian, make sure libseccomp2 version is 2.5.x. You can check the version with sudo apt-cache policy libseccomp2 and update the package with sudo apt install libseccomp2=2.5.1-1~bpo10+1 or sudo apt install libseccomp2=2.5.1-1+deb11u1. Remember to restart the Docker daemon and the container after the update.
DO NOT expose FlareSolverr to the internet, as it can be abused.

Precompiled binaries

Warning Precompiled binaries are only available for x64 architecture. For other architectures see Docker images.

This is the recommended way for Windows users.
  • Download the FlareSolverr executable from the release's page. It is available for Windows x64 and Linux x64.
  • Execute FlareSolverr binary. In the environment variables section you can find how to change the configuration.

From source code

Warning Installing from source code only works for x64 architecture. For other architectures see Docker images.

  • Install Python 3.11.
  • Install Chrome (all OS) or Chromium (just Linux, it doesn't work in Windows) web browser.
  • (Only in Linux) Install Xvfb package.
  • (Only in macOS) Install XQuartz package.
  • Clone this repository and open a shell in that path.
  • Run pip install -r requirements.txt command to install FlareSolverr dependencies.
  • Run python src/flaresolverr.py command to start FlareSolverr.

From source code (FreeBSD/TrueNAS CORE)

  • Run pkg install chromium python313 py311-pip xorg-vfbserver command to install the required dependencies.
  • Clone this repository and open a shell in that path.
  • Run python3.11 -m pip install -r requirements.txt command to install FlareSolverr dependencies.
  • Run python3.11 src/flaresolverr.py command to start FlareSolverr.

Systemd service

We provide an example Systemd unit file flaresolverr.service as reference. You have to modify the file to suit your needs: paths, user and environment variables.

Usage

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

Example Python request:
import requests

url = "http://localhost:8191/v1"
headers = {"Content-Type": "application/json"}
data = {
    "cmd": "request.get",
    "url": "http://www.google.com/",
    "maxTimeout": 60000
}
response = requests.post(url, headers=headers, json=data)
print(response.text)

Example PowerShell request:
$body = @{
    cmd = "request.get"
    url = "http://www.google.com/"
    maxTimeout = 60000
} | ConvertTo-Json

irm -UseBasicParsing 'http://localhost:8191/v1' -Headers @{"Content-Type"="application/json"} -Method Post -Body $body

Commands

  • sessions.create

This will launch a new browser instance which will retain cookies until you destroy it with sessions.destroy. This comes in handy, so you don't have to keep solving challenges over and over and you won't need to keep sending cookies for the browser to use.
This also speeds up the requests since it won't have to launch a new browser instance for every request.
ParameterNotes
sessionOptional. The session ID that you want to be assigned to the instance. If isn't set a random UUID will be assigned.
proxyOptional, default disabled. Eg: "proxy": {"url": "http://127.0.0.1:8888"}. You must include the proxy schema in the URL: http://, socks4:// or socks5://. Authorization (username/password) is supported. Eg: "proxy": {"url": "http://127.0.0.1:8888", "username": "testuser", "password": "testpass"}

  • sessions.list

Returns a list of all the active sessions. More for debugging if you are curious to see how many sessions are running. You should always make sure to properly close each session when you are done using them as too many may slow your computer down.
Example response:
{
  "sessions": ["session_id_1", "session_id_2", "session_id_3..."]
}

  • sessions.destroy

This will properly shutdown a browser instance and remove all files associated with it to free up resources for a new session. When you no longer need to use a session you should make sure to close it.
ParameterNotes
sessionThe session ID that you want to be destroyed.

  • request.get

ParameterNotes
urlMandatory
sessionOptional. Will send the request from and existing browser instance. If one is not sent it will create a temporary instance that will be destroyed immediately after the request is completed.
sessionttlminutesOptional. FlareSolverr will automatically rotate expired sessions based on the TTL provided in minutes.
maxTimeoutOptional, default value 60000. Max timeout to solve the challenge in milliseconds.
cookiesOptional. Will be used by the headless browser. Eg: "cookies": {"name": "cookie1", "value": "value1"}, {"name": "cookie2", "value": "value2"}.
returnOnlyCookiesOptional, default false. Only returns the cookies. Response data, headers and other parts of the response are removed.
returnScreenshotOptional, default false. Captures a screenshot of the final rendered page after all challenges and waits are completed. The screenshot is returned as a Base64-encoded PNG string in the screenshot field of the response.
proxyOptional, default disabled. Eg: "proxy": {"url": "http://127.0.0.1:8888"}. You must include the proxy schema in the URL: http://, socks4:// or socks5://. Authorization (username/password) is not supported. (When the session parameter is set, the proxy is ignored; a session specific proxy can be set in sessions.create.)
waitInSecondsOptional, default none. Length to wait in seconds after solving the challenge, and before returning the results. Useful to allow it to load dynamic content.
disableMediaOptional, default false. When true FlareSolverr will prevent media resources (images, CSS, and fonts) from being loaded to speed up navigation.
tabstillverifyOptional, default none. Number of times the Tab button is needed to be pressed to end up on the turnstile captcha, in order to verify it. After verifying the captcha, the result will be stored in the solution under turnstiletoken.

Warning If you want to use Cloudflare clearance cookie in your scripts, make sure you use the FlareSolverr User-Agent too. If they don't match you will see the challenge.

Example response from running the curl above:
{
  "solution": {
    "url": "https://www.google.com/?gws_rd=ssl",
    "status": 200,
    "headers": {
      "status": "200",
      "date": "Thu, 16 Jul 2020 04:15:49 GMT",
      "expires": "-1",
      "cache-control": "private, max-age=0",
      "content-type": "text/html; charset=UTF-8",
      "strict-transport-security": "max-age=31536000",
      "p3p": "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"",
      "content-encoding": "br",
      "server": "gws",
      "content-length": "61587",
      "x-xss-protection": "0",
      "x-frame-options": "SAMEORIGIN",
      "set-cookie": "1P_JAR=2020-07-16-04; expires=Sat..."
    },
    "response": "<!DOCTYPE html>...",
    "cookies": [
      {
        "name": "NID",
        "value": "204=QE3Ocq15XalczqjuDy52HeseG3zAZuJzID3R57...",
        "domain": ".google.com",
        "path": "/",
        "expires": 1610684149.307722,
        "size": 178,
        "httpOnly": true,
        "secure": true,
        "session": false,
        "sameSite": "None"
      },
      {
        "name": "1P_JAR",
        "value": "2020-07-16-04",
        "domain": ".google.com",
        "path": "/",
        "expires": 1597464949.307626,
        "size": 19,
        "httpOnly": false,
        "secure": true,
        "session": false,
        "sameSite": "None"
      }
    ],
    "userAgent": "Windows NT 10.0; Win64; x64) AppleWebKit/5...",
    "turnstile_token": "03AGdBq24k3lK7JH2v8uN1T5F..."
  },
  "status": "ok",
  "message": "",
  "startTimestamp": 1594872947467,
  "endTimestamp": 1594872949617,
  "version": "1.0.0"
}

  • request.post

This works like request.get, with the addition of the postData parameter. Note that tabs_till_verify is currently supported only for GET requests and requires one extra argument.
ParameterNotes
postDataMust be a string with application/x-www-form-urlencoded. Eg: a=b&c=d

Environment variables

NameDefaultNotes
LOGLEVELinfoVerbosity of the logging. Use LOGLEVEL=debug for more information.
LOGFILEnonePath to capture log to file. Example: /config/flaresolverr.log.
LOGHTMLfalseOnly for debugging. If true all HTML that passes through the proxy will be logged to the console in debug level.
PROXYURLnoneURL for proxy. Will be overwritten by request or sessions proxy, if used. Example: http://127.0.0.1:8080.
PROXYUSERNAMEnoneUsername for proxy. Will be overwritten by request or sessions proxy, if used. Example: testuser.
PROXYPASSWORDnonePassword for proxy. Will be overwritten by request or sessions proxy, if used. Example: testpass.
CAPTCHASOLVERnoneCaptcha solving method. It is used when a captcha is encountered. See the Captcha Solvers section.
TZUTCTimezone used in the logs and the web browser. Example: TZ=Europe/London.
LANGnoneLanguage used in the web browser. Example: LANG=enGB.
HEADLESStrueOnly for debugging. To run the web browser in headless mode or visible.
DISABLEMEDIAfalseTo disable loading images, CSS, and other media in the web browser to save network bandwidth.
TESTURLhttps://www.google.comFlareSolverr makes a request on start to make sure the web browser is working. You can change that URL if it is blocked in your country.
PORT8191Listening port. You don't need to change this if you are running on Docker.
HOST0.0.0.0Listening interface. You don't need to change this if you are running on Docker.
PROMETHEUSENABLEDfalseEnable Prometheus exporter. See the Prometheus section below.
PROMETHEUSPORT8192Listening port for Prometheus exporter. See the Prometheus section below.

Environment variables are set differently depending on the operating system. Some examples:
  • Docker: Take a look at the Docker section in this document. Environment variables can be set in the docker-compose.yml file or in the Docker CLI command.
  • Linux: Run export LOG_LEVEL=debug and then run flaresolverr in the same shell.
  • Windows: Open cmd.exe, run set LOG_LEVEL=debug and then run flaresolverr.exe in the same shell.

Prometheus exporter

The Prometheus exporter for FlareSolverr is disabled by default. It can be enabled with the environment variable PROMETHEUS_ENABLED. If you are using Docker make sure you expose the PROMETHEUS_PORT.
Example metrics:
# HELP flaresolverr_request_total Total requests with result
# TYPE flaresolverr_request_total counter
flaresolverr_request_total{domain="nowsecure.nl",result="solved"} 1.0
# HELP flaresolverr_request_created Total requests with result
# TYPE flaresolverr_request_created gauge
flaresolverr_request_created{domain="nowsecure.nl",result="solved"} 1.690141657157109e+09
# HELP flaresolverr_request_duration Request duration in seconds
# TYPE flaresolverr_request_duration histogram
flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="0.0"} 0.0
flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="10.0"} 1.0
flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="25.0"} 1.0
flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="50.0"} 1.0
flaresolverr_request_duration_bucket{domain="nowsecure.nl",le="+Inf"} 1.0
flaresolverr_request_duration_count{domain="nowsecure.nl"} 1.0
flaresolverr_request_duration_sum{domain="nowsecure.nl"} 5.858
# HELP flaresolverr_request_duration_created Request duration in seconds
# TYPE flaresolverr_request_duration_created gauge
flaresolverr_request_duration_created{domain="nowsecure.nl"} 1.6901416571570296e+09

Captcha Solvers

Warning At this time none of the captcha solvers work. You can check the status in the open issues. Any help is welcome.

Sometimes CloudFlare not only gives mathematical computations and browser tests, sometimes they also require the user to solve a captcha. If this is the case, FlareSolverr will return the error Captcha detected but no automatic solver is configured.
FlareSolverr can be customized to solve the CAPTCHA automatically by setting the environment variable CAPTCHA_SOLVER to the file name of one of the adapters inside the /captcha directory.

Related projects

  • C# implementation => https://github.com/FlareSolverr/FlareSolverrSharp

Serve FlareSolverr on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.

Proxying flaresolverr.example.com to http://FlareSolverr:8191

Add this to your Caddyfile

flaresolverr.example.com {
	reverse_proxy http://FlareSolverr:8191
}

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs FlareSolverr
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Port already in use

If deployment fails with "Bind for 0.0.0.0:8191 failed: port is already allocated", something else on your server is using that port.

  • Find what's using it: sudo ss -tlnp | grep :8191
  • Stop the other service, or pick a different host port. In 8191:8191 only the left number is yours to change, the right one belongs to the app.

Running but the page won't load

The container is up but nothing appears in your browser.

  • Use your server's real IP: http://your-server-ip:8191. The 0.0.0.0 link Portainer shows isn't a real address.
  • Give it a minute after first deploy, FlareSolverr can take a while to initialise.
  • Make sure your firewall allows the port, e.g. sudo ufw allow 8191

Image won't pull

Test the pull directly on the host: docker pull ghcr.io/flaresolverr/flaresolverr:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64, arm64, arm/v7, 386
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect FlareSolverr --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Data disappears when the container is recreated

This template doesn't define any volumes, so everything FlareSolverr saves lives inside the container and is lost on update or recreate.

  • Add a volume mapping for FlareSolverr's data folder before storing anything you care about.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

A single container

FlareSolverr runs as one container, the simplest kind of app here. Just the one image to pull and nothing else wired up alongside it.

The app image

An image is the app packed up ready to go, everything FlareSolverr needs bundled into one download. This template pulls ghcr.io/flaresolverr/flaresolverr:latest, which Docker fetches once (about 269 MB) and then starts your own copy from.

Where the image comes from

Docker pulls its images from registries, public libraries of ready-built apps. FlareSolverr's comes from the GitHub Container Registry, published by flaresolverr.

Version tags

The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Pin a specific tag if you would rather stay on one version.

Which machines it runs on

Every image is built for particular CPU types. This one ships for amd64, arm64, arm/v7, 386, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.

Ports

A port is the door the app answers on. A mapping like 8191:8191 means it's reachable on port 8191 of your server, where the left number is yours to change and the right one belongs to the app. It opens:

  • 8191:8191

No stored data

This template doesn't mount any storage, so whatever FlareSolverr writes stays inside the container and is wiped if it's recreated or updated. That's fine for something stateless, but add a volume before trusting it with anything you want to keep.

Environment variables

Environment variables are the settings you hand over when you deploy, things like a password or a timezone. FlareSolverr takes 4 of them, all with defaults you can leave alone or tweak:

  • LOG_LEVEL, defaults to info
  • LOG_HTML, defaults to false
  • CAPTCHA_SOLVER, defaults to none
  • TZ, defaults to America/New_York

Restart policy

The restart policy here is unless-stopped, so Docker restarts FlareSolverr after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).

Networking

Nothing custom is set, so FlareSolverr sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.

Container name

Once it's deployed, Portainer names the container FlareSolverr. That's what you'll spot in the containers list and use in commands like docker logs FlareSolverr.

Platform

The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.

Open source license

FlareSolverr is open source, released under the MIT license. In plain terms the code is out in the open, so you're free to run it and change it to fit what you need.

Portainer app templates

Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set FlareSolverr up. Add the template list to Portainer once, then deploying FlareSolverr is a click rather than a wall of config.