Tinyproxy is a lightweight http(s) proxy daemon, and for Raspberry Pi this will work great. Official documentation.

Install Tinyproxy

sudo apt-get install tinyproxy

Configure

By default Tinyproxy will only accept connections from localhost, so in order to connect to the proxy from other devices on your local network you need to specify their IPs in config. You can also specify a port that Tinyproxy will run on

sudo cp /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.conf.backup
sudo nano /etc/tinyproxy/tinyproxy.conf

Tip: Hit ctrl+w then type “Allow” in the config file to find the line in question and add your IPs.

Proxy traffic through a VPN

If you run a VPN on the same device running Tinyproxy, then all outgoing traffic, including proxied traffic, will route through the VPN. This may seem like a silly usecase as you could just run a VPN client on the machine itself; however, there are usecase where you’d like only certain traffic to be routed through a VPN. In this case, most browsers and some services (Sonarr or Radarr for example) allow you to specify a proxy endpoint.

Useful commands

Check the status of TinyProxy

sudo systemctl status tinyproxy

Restart TinyProxy

sudo systemctl restart tinyproxy

Read TinyProxy logs

# Show all logs
sudo tail -f /var/log/tinyproxy/tinyproxy.log

# Show only log lines that have a certain keyword
sudo tail -f /var/log/tinyproxy/tinyproxy.log | grep "CONNECT"