# PF: redirecting local traffic to localhost



## dbi (Nov 24, 2010)

Hi,

I'm trying to setup a transparent squid.
While intercepting traffic from other hosts works fine, I can't figure out how to redirect locally originated packets to the proxy daemon.
Squid is listening on 127.0.0.1:3128 with the "intercept" flag set.
PF redirects the http traffic like this:


```
rdr on msk0 from any to any port 80 -> 127.0.0.1 port 3128
```

So far, so good, but how should I redirect the packets from the squid box itself?
The rule I'm looking for looks like this on Linux:


```
iptables -t nat -I OUTPUT -m owner ! --uid-owner squid -p tcp --dport 80 -j REDIRECT --to-port 3128
```


----------

