rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4443 rdr pass on en0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 rdr pass on en0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4443
6.2、检查其正确性
1
sudo pfctl -vnf /etc/pf.anchors/http
6.3、修改 pf 的主配置文件 /etc/pf.conf 开启我们添加的锚点 http
/etc/pf.conf
在 rdr-anchor “com.apple/*” 下添加 rdr-anchor “http-forwarding” 在 load anchor “com.apple” from “/etc/pf.anchors/com.apple” 下添加 load anchor “http-forwarding” from “/etc/pf.anchors/http”