I have to forward every internet page to my local address i.e. 127.0.0.1 using OS X.
I tried following command but it has no effect:
echo " rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 " | sudo pfctl -ef -
I have tried to research the exact meaning of the above line but I can't find a good explanation. How do I perform this forwarding?
Edit 1:
Let's say a user enters "www.google.com" in the browser; this should have an impact like this -->
User should be redirected to my local page which is at 127.0.0.1:8080
Now, if I hit 127.0.0.1:8080 I do see my local portal.
But, I want it to be shown after redirection from "Google.com"
I am writing following statement. But, they are not having any effect.
rdr pass on lo0 proto {tcp, udp} from any to any port 80 -> 127.0.0.1 port 7894
pass out log(all) on em0 route-to lo0 inet proto {tcp, udp} from any to any port 80 keep state
I am writing above lines in my anchor file and adding anchor to pf.conf using rdr-anchor
google.com
will immediately redirect you to https and bypass your redirection, if you configure redirection for port 443, you will get a certificate error in the browser. Is that what you are trying to achieve?