Ipfw rule to forward all traffic through a local proxy

http-proxyipfw

I want to set up a local http proxy for testing and stubbing apps that make external api calls over http.

I'm not sure the best way to do this with ipfw, I want to run my proxy as a particular user, then redirect all http traffic to this proxy, but I need to allow all http trafic from this user, what are the particular ipfw rules for this?

I am using OS X.

Best Answer

ipfw add 666 fwd 127.0.0.1,80 tcp from me to any 80 not uid user_proxy

This should theoretically forward locally generated traffic directed at some port 80 to localhost:80, where the proxy is running under the user_proxy user. I have no idea why this doesn't work. On my system the machine just dies after I do it (OS X 10.8). Did you manage to solve your problem?