I want locally generated packets to pass through PREROUTING chain bacause I want to use
sudo iptables -t mangle -A PREROUTING -p tcp -d somewebsite.com -j TPROXY --on-port 32794
to redirect all packets (generated by a local process) heading to somewesite.com to local port 32794.
Many people suggested this instead:
sudo iptables -t nat -A OUTPUT -p tcp -d somewebsite.com -j REDIRECT --to-ports 32794
but REDIRECT will modify packet header which I am trying to avoid. I have to use TPROXY, it's the only target type that doesn't modify packet headers.
So what should I do to let locally generated packets pass through PREROUTING chain? Maybe using loopback? But I am not sure whether loopback changes packet headers either...