Transparent TCP proxy that captures pfctl-redirected HTTP/HTTPS traffic and forwards through Privoxy without TLS interception.
This project solves a unique challenge: how to transparently proxy iOS apps that ignore global proxy settings while not interfering with apps that honor them.
- 📱 Proxy-Aware Apps (Safari, Chrome): Use configured proxy settings → Connect directly to Privoxy
- 🚫 Proxy-Unaware Apps (Netflix, Games): Ignore proxy settings → Try direct connections to servers
Strategic pfctl rules that create two paths:
# Path 1: EXEMPT proxy-aware traffic (to Mac/Privoxy)
no rdr on bridge100 inet proto tcp from 192.168.2.4 to 194.165.185.154
# Path 2: INTERCEPT proxy-unaware traffic (to external servers)
rdr pass on bridge100 inet proto tcp from 192.168.2.4 to any -> 127.0.0.1 port 8001Result: Both app types work seamlessly while all traffic gets filtered through Privoxy! 🎉
📖 Complete Technical Guide - Deep dive into network layers, TLS handshakes, and transparent proxying internals
src/transparent_tcp_proxy.py— main proxyconfig/pf/pf-transproxy.conf.example— pf rules sampleconfig/pac/proxy.pac— sample PACconfig/mobileconfig/GlobalHTTPProxy.mobileconfig— PAC-based profileconfig/mobileconfig/ManualProxy.mobileconfig— manual proxy profile
- HTTP: rewrites to absolute-form and forwards to Privoxy
- HTTPS: CONNECT via Privoxy using SNI, tunnels bytes (no MITM)
- Skips PAC requests; basic logging; CLI/env config
-
Install and start Privoxy (or any HTTP proxy) locally, note host:port (default here: 127.0.0.1:48082)
-
Run the transparent proxy:
python3 src/transparent_tcp_proxy.py \
--listen-ip 0.0.0.0 --listen-port 8001 \
--privoxy-ip 127.0.0.1 --privoxy-port 48082- pf redirect for HTTP/HTTPS to the proxy. Edit interface/subnet in the example and load:
sudo cp config/pf/pf-transproxy.conf.example /etc/pf-transproxy.conf
sudo pfctl -f /etc/pf-transproxy.conf
sudo pfctl -ERestore defaults later:
sudo pfctl -f /etc/pf.conf
sudo pfctl -d- iOS configuration profiles
- PAC (GlobalHTTPProxy.mobileconfig): points to your Mac-hosted PAC file
- ManualProxy.mobileconfig: direct HTTP(S) proxy settings
Use Apple Configurator or AirDrop to install. Edit server IPs/ports before use.
python3 -m py_compile src/transparent_tcp_proxy.py- Non-HTTP/TLS traffic can’t be proxied without original destination info on macOS.
- For testing PAC, host
config/pac/proxy.pacvia a simple HTTP server.