Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Ideally i m trying to use my laptop and a 3Gphone as a WiFi router to redirect FORWARD HTTP but not HTTPS Traffic to privoxy which then forwards the traffic via a SSH tunnel to a ziproxy VPS.

for the sake of simplicity privoxy is currently set to defaults ie is not forwarding to another proxy. with exception to accept intersepts 1

also sysctl net.ipv4.ip_forward=1

the following iptable commands work locally but is ignored by FORWARD traffic ie users connected by wifi are not filtered by privoxy but the local user is, i want the opposite behaviour

iptables -t nat -A POSTROUTING -o ${INTERNET_IFACE} -j MASQUERADE
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner privoxy -j ACCEPT
iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8118
iptables -A FORWARD -i ${WIFI_IFACE} -j ACCEPT

How do I force FORWARD HTTP traffic to go through privoxy ?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The reason it doesn't work is because you can only modify packets in certain ways at certain parts of the netfilter stack. Modifying the destination on the way out is too late. You need to modify it on the way in.

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8118

I recommend researching the various tables that make up the netfilter stack.

share|improve this answer
    
I agree that PREROUTING is the correct point in the stack as traffic is being redirected. but i am now have trouble with misformed http headers, I am thinking that this howerver is a site specific problem and that the above should work for everyone else. –  ArchNemSyS Oct 16 '13 at 10:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.