Redirecting http traffic

Sometimes, simple solutions are the best

> iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 8888
> iptables -t nat -I OUTPUT -p tcp -o lo --dport 80 -j REDIRECT --to-ports 8888

# in case we want to list what we have

> iptables -t nat -nvL --line-numbers

# if we decide to remove the rule - ## stands for rule No.

> iptables -D PREROUTING ## -t nat
> iptables -D OUTPUT ## -t nat

Leave a comment

Your comment