Privoxy

Privoxy is a non-caching web proxy server with advanced filtering capabilities which can improve privacy. It works by removing or modifying elements of a HTTP request and its response, either on the headers or on the body of the request.

Although comparable to some browser extensions, being a server, it allows different programs to use it, removing the need to add extensions to each browser and with it, its potential associated problems like incompatibilities between extensions. It also helps to reduce browser fingerprinting thanks to the reduction of installed extensions.

It may be combined with caching proxies like squid to improve its overall speed.

Emerge
To install :

To start the service automatically at boot
 OpenRC 

 systemd 

To start the service manually
 OpenRC 

 systemd 

Configuration
Once the server is running, clients have to be made aware of it, to do so, the proxy configuration should be adjusted on each program.

Firefox
Edit > Settings > Network Settings > Settings > Manual proxy configuration

HTTP Proxy 127.0.0.1 Port 8118

Mark the checkbox Also use this proxy for HTTPS

Advanced configuration
The default values on Privoxy should work well for most cases, but further configuration can be made using the following methods.

.

Web configuration
Pointing a browser like Firefox to status and configuration page.

Editing configuration files manually
All the configuration files are located at.

The following are two common cases for modifying the base configuration:

To change the default port where Privoxy listens
look for

and change it to the desired port, for instance, if the desired port is 8080

To block specific sites
Using a text editor as root edit.

and add this at the end

Testing
Once the server is running, different tools and methods can be used to test if it is working properly.

lsof
If no client has been used yet, only the first line will be present. If a client has issued a request then more results will be present on the output of the command

On a browser
Following the link config.privoxy.org will trigger a default filter on privoxy which will serve a page with the text:

This is Privoxy 3.0.32 on localhost (127.0.0.1), port 8118, enabled

a section with the Privoxy Menu and a section with support links.

By itself
Once clients are made aware of the proxy by adjusting their settings to point to the privoxy server they will start using it, including any changes made to the configuration files since the server doesn't have to be restarted to update its behaviour

Forwarding traffic through Tor
Tor is a powerful tool for the anonymity seekers and for many years has been used in combination with privoxy.

As root edit

look for

and change it to

Using Squid as cache proxy
After installing Squid and Privoxy, set the clients to use Squid and set Squid to forward traffic to Privoxy.

For instance, change the proxy configuration on Firefox following the steps mentioned above but instead of port 8118 set it to 3128. After that, as root edit and add the following lines:

Using Squid + Privoxy + Tor
After following all the steps above, the full chain should be working. To confirm that everything is working fine, visit the following 2 URLs.
 * 1) config.privoxy.org
 * 2) Tor check

The first URL should get the same result as the browser test done before

The second URL should end in a page with the text '''Congratulations. This browser is configured to use Tor'''.

Caveats
Although removing elements from the page makes it lighter and the privoxy process tiself is not big or slow, if too many filters are working at the same time, the final result may be a bit slower than browsing without privoxy.

External resources

 * Quickstart to Using Privoxy
 * Privoxy Frequently Asked Questions
 * Official User manual
 * Privoxy questions on StackExchange
 * Onion link to the Privoxy Home page
 * Test of a request page (only works if Privoxy is working)
 * Check rules applied to a page (only works if Privoxy is working)