Skip to content

Instantly share code, notes, and snippets.

@ufocoder
Created December 9, 2018 10:10
Show Gist options
  • Save ufocoder/52787fc5526ba009da7847f779e1d4d6 to your computer and use it in GitHub Desktop.
Save ufocoder/52787fc5526ba009da7847f779e1d4d6 to your computer and use it in GitHub Desktop.

Forward Port 80 and 443 with Mac pfctl Port Forwarding You can copy and paste the following onto the command line.

echo "
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
" | sudo pfctl -ef -

Remove Port Forwarding

sudo pfctl -F all -f /etc/pf.conf

Display Your Current Port Forwarding Rules

sudo pfctl -s nat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment