about firewall - xieyunzi/xieyunzi.github.io GitHub Wiki


mac os pf

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

pfctl -s nat

https://salferrarello.com/mac-pfctl-port-forwarding/ https://apple.stackexchange.com/questions/230300/what-is-the-modern-way-to-do-port-forwarding-on-el-capitan-forward-port-80-to https://www.openbsd.org/faq/pf/index.html