Skip to content

Instantly share code, notes, and snippets.

@sbolel
Last active March 9, 2018 02:37
Show Gist options
  • Save sbolel/db5ad50c3f72c6a18ab6c7e7a924dcb9 to your computer and use it in GitHub Desktop.
Save sbolel/db5ad50c3f72c6a18ab6c7e7a924dcb9 to your computer and use it in GitHub Desktop.
pfctl hack: forward localhost port to another port
#!/usr/bin/env bash
# forward localhost:8000 to localhost:3000
echo "rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 8000 -> 127.0.0.1 port 3000" | sudo pfctl -ef -
# remove it
sudo pfctl -F all -f /etc/pf.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment