FlareSolverr is a proxy server to bypass Cloudflare protection.
I found it while looking for a way to fix a problem: my Jackett installation one day started to give errors when trying to access 1337x. You got the point...
Here are the instructions in order to get FlareSolverr configured and running at boot in a FreeBSD system or in a FreeNAS/TrueNAS jail (which is my case, by the way).
This works only for version 2.1.0. For version 2.2.0, I was unable to make it work. I'm sorry.
This was made in a TrueNAS Core 12.0-U7 which uses 12.2-RELEASE-p11 as base.
All instructions consider that you will be using the root user to execute the commands and to run FlareSolver. If you want or need to use a regular user, adapt the instructions accordingly.
I'll not enter in details about creation of jails, but here is the main screen of my jail creation form for your reference:
So, after creating a simple jail (clone jail, vnet interface), follow these instructions:
In my case it is necessary:
rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
Before anything else, make sure that your packages are updated and upgraded:
pkg update
pkg upgrade
Here you have the option to use Git or download the sources directly. It doesn't matter what you choose, the final product will be the same.
The advantage of the Git way is that it is easier to keep FlareSolverr updated.
So, follow 3.1 or 3.2, as you wish.
Install the git-tiny package:
pkg install git-tiny
Then go to /usr/local/share folder and clone the repository:
cd /usr/local/share
git clone https://github.com/FlareSolverr/FlareSolverr.git
Go to the FlareSolverr Github page, click on Code, then right-click on "Download ZIP" and then choose "Copy link address":
Then execute the fetch command to download the zip file, by pasting the copied address in the command line, and then run the unzip command to extract it:
fetch https://github.com/FlareSolverr/FlareSolverr/archive/refs/heads/master.zip
unzip master.zip
Now move the FlareSolverr-master folder to /usr/local/share changing the folder's name to just FlareSolverr:
mv FlareSolverr-master /usr/local/share/FlareSolverr
Once you have the FlareSolverr source code downloaded through Git or Zip in /usr/local/share/FlareSolverr, the next step is to download the necessary packages.
Install these packages and all their required dependencies:
pkg install npm-node14 chromium
Around 170 packages should be installed.
Notes:
From now on, everything should be executed inside the FlareSolverr installation folder, that is /usr/local/share/FlareSolverr
The command execution order is important!
setenv is a CShell command; adapt if you're using another shell
I confess that I don't understand yet why the double installation of puppeteer is necessary; I guess that this is a bug or something. I'll update this guide when I find the reason (I hope...)
Execute the following commands to install FlareSolverr:
cd /usr/local/share/FlareSolverr
setenv PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
setenv PUPPETEER_EXECUTABLE_PATH /usr/local/bin/chrome
npm install
node node_modules/puppeteer/install.js
npm install [email protected]
npm install puppeteer
npm run build
In order to test if FlareSolverr is configured and can run, execute:
cd /usr/local/share/FlareSolverr
npm start
If everything is fine, you should see something like this:
root@flaresolverr:/usr/local/share/FlareSolverr # npm start
> [email protected] start /usr/local/share/FlareSolverr
> node ./dist/server.js
2022-01-01T20:32:20-03:00 INFO FlareSolverr v2.1.0
2022-01-01T20:32:20-03:00 INFO Testing web browser installation...
2022-01-01T20:32:21-03:00 INFO FlareSolverr User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/94.0.4606.81 Safari/537.36
2022-01-01T20:32:21-03:00 INFO Test successful
2022-01-01T20:32:21-03:00 INFO Listening on http://flaresolverr:8191
This means that FlareSolverr is running and listening on port 8191 in the localhost interface (which is useless in some cases, but we will fix this in no time).
Congratulations!
If not... get back and check the steps above.
In order to have FlareSolverr running at system boot or jail start, create a file named /usr/local/etc/rc.d/flaresolverr with the following content:
#!/bin/sh
#
# Author: C. R. Zamana (czamana at gmail dot com)
#
# PROVIDE: flaresolverr
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="flaresolverr"
rcvar="${name}_enable"
load_rc_config ${name}
: ${flaresolverr_enable:="NO"}
pidfile="/var/run/flaresolverr.pid"
start_precmd="flaresolverr_precmd"
PATH=$PATH:/usr/local/bin
flaresolverr_precmd() {
cd /usr/local/share/FlareSolverr
export PUPPETEER_EXECUTABLE_PATH=/usr/local/bin/chrome
export HOST=0.0.0.0
}
command="/usr/sbin/daemon"
command_args="-P ${pidfile} /usr/local/bin/npm start > /dev/null"
run_rc_command "$1"
Give it the execute permissions:
chmod +x /usr/local/etc/rc.d/flaresolverr
And make it run at sytem boot/jail start:
sysrc flaresolverr_enable=YES
And now you are ready to control the service with:
service flaresolverr start | stop | status
Note that the script sets the variable HOST as 0.0.0.0 which will make FlareSolverr to listen in all interfaces, which is what you want if you are using it in a system and acessing it from another. Feel free to change this according with your needs.
Beyond service flaresolverr status
, another way to check that the process is really running and listening at the port 8191, is:
netstat -an | grep 8191
Now that you have FlareSolverr alive and kicking, you can use it in your Jackett installation, like this:
Happy FlareSolverring ;-)
hello, flaresolverr works perfectly (i believe...) "{"msg":"FlareSolverr is ready!","version":"v2.1.0",bla bla bla" but each time jackett returns this error :
Exception (yggcookie): FlareSolverr was unable to process the request, please check FlareSolverr logs. Message: Error: Unable to process browser request. Error: Maximum timeout reached. maxTimeout=55000 (ms): FlareSolverr was unable to process the request, please check FlareSolverr logs. Message: Error: Unable to process browser request. Error: Maximum timeout reached. maxTimeout=55000 (ms)
Any idea?