windows共享调试chrome方法

需要将一个公共 Chrome 浏览器共享给多端调试, 避免反复多处登录账号.

# chrome启动命令
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
  --remote-debugging-address=127.0.0.1 `
  --remote-debugging-port=34037 `
  --user-data-dir="M:\chrome-remote"

这里需要特别注意的是, 新版 chrome 为安全考虑, 已不支持将 chrome 暴露到 0.0.0.0, remote-debugging-address 实际不会生效

# 增加防火墙放行规则:
netsh advfirewall firewall add rule name="Chrome DevTools 34037 LAN" dir=in action=allow protocol=TCP localport=34037

# 建立 portproxy(系统层反代):
netsh interface portproxy add v4tov4 listenport=34037 listenaddress=192.168.31.2 connectport=34037 connectaddress=127.0.0.1

# 清掉portproxy 规则
# netsh interface portproxy reset

# 测试生效
curl http://127.0.0.1:34037/json/version
curl http://192.168.31.2:34037/json/version