Privoxy as intercepting proxy

248 Views Asked by At

I want to setup Privoxy to be able to filter all http requests that my Wordpress page are sending and receiving, but I have hard time trying to do it.

I setup Wordpress with bitnami package and privoxy with apt-get install and found out that in order to intercept all of requests I have to turn on "accept-intercepted-requests" and actually redirect them with iptables. I Tried this command to do so:

sudo iptables -t nat -D OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8118

But when I try to access website outside of localhost I have connection refused message.

My question is: is it possible to intercept all http request of webserver with privoxy and iptables or maybe I have to use some other software to achieve this?

1

There are 1 best solutions below

0
On BEST ANSWER

I figured it out, so I am posting solution for anyone who also struggles with this:

sudo iptables -t nat -A PREROUTING -i {INTERFACE_NAME} -p tcp --dport {WEBSITE_PORT} -j REDIRECT --to-port {PROXY_PORT}

where:

  • INTERFACE_NAME - name of your VM interface which can be get with the ifconfig command (for me it was ens33)
  • WEBSITE_PORT - port on which your apache2 service is listening (default is 80 or 8080)
  • PROXY_PORT - port of Privoxy (default is 8118)

It works with every website that is hosted using Apache. (I tested it also with phpBB and it works with no problems.)