This applies to a local port on localhost that your destined port 80 traffic will be routed too instead:
iptables -t nat -I OUTPUT -p tcp –dport 80 -j REDIRECT –to-ports 8123
Make sure you do something like the following (where you specify the interface) if you don’t want requuests to localhost also sent out the proxy:
iptables -t nat -I OUTPUT -o eth0 -p tcp –dport 80 -j REDIRECT –to-ports 8123