While configuring a router, we decided to have privoxy and polipo work together in order to cache web-content in order to speed up browsing.
confdir /etc/privoxy logdir /var/log actionsfile standard.action # Internal purpose, recommended actionsfile default.action # Main actions file actionsfile user.action # User customizations filterfile default.filter logfile privoxy_logfile jarfile privoxy_jarfile trust-info-url http://www.example.com/why_we_block.html trust-info-url http://www.example.com/what_we_allow.html #admin-address privoxy-admin@example.com #proxy-info-url http://www.example.com/proxy-service.html debug 1 # show each GET/POST/CONNECT request debug 4096 # Startup banner and warnings debug 8192 # Errors - *we highly recommended enabling this* listen-address 192.168.1.1:8118 toggle 1 enable-remote-toggle 0 enable-edit-actions 0 enable-remote-http-toggle 0 accept-intercepted-requests 1 forward / 192.168.1.1:8123 permit-access 192.168.1.0/24 buffer-limit 4096
where 192.168.1.1
is the router network IP address.
We set-up a quota for Polipo
since by design it is not aware of free space:
mkdir -p /home/polipo dd if=/dev/zero of=/home/polipo/polipo.img bs=1M count=256 mkfs.ext3 /home/polipo/polipo.img
where count
is the value in MB
. In this case we use 256MB
of disk space dedicated to cache.
Now we create a loopback device for /home/polipo/polipo.img
losetup /dev/loop/0 /home/polipo/polipo.img mount -t ext3 /dev/loop/0 /home/polipo
and make that persistent by adding a line to fstab
:
/dev/loop/0 /home/polipo ext3 noatime 0 0
finally, we create the polipo
configuration file:
proxyAddress = "192.168.1.1" # IPv4 only allowedClients = "192.168.1.1" cacheIsShared = true dnsQueryIPv6 = no
iptables -t nat -A PREROUTING -i br-lan -p tcp --dport 80 -j DNAT --to 192.168.1.1:8118
where br-lan
is the lan interface; in this case, a bridge of several interfaces.
privoxy
with them.forbidden
file for polipo
- turns out, polipo
performs faster ad-blocking.