whistle代理

730 阅读1分钟

定位线上问题的方式之一,可以使用代理到本地调试。

安装whislte

安装node

brew install node

安装whistle

npm install whistle -g --registry=https://registry.npm.taobao.org

添加环境变量

cancanliu@cancanliu ~ % vim ~/.bash_profile
export PATH=$PATH:/Users/cancanliu/.npm-global/bin:$PATH

使环境变量永久生效

创建编辑.zshrc文件,添加source ~/.bash_profile命令

vim ~/.zshrc
source ~/.bash_profile

启动w2代理

cancanliu@cancanliu ~ % w2 start

chrome浏览器安装插件whistle,并启用代理状态

image-20200920175534229 image-20200920180827161

web端代理到本地

  • 浏览器访问http://127.0.0.1:8899/

  • 配置代理url

    image-20200920181153227

app代理到本地

  • 手机安装证书,点击https,下载rootca,将证书发送到手机,并安装证书

    image-20200920181318362
    image-20200920181318362
  • 设置电脑和手机使用同一个wifi,配置手机wifi为手动代理,主机名:查看电脑ipv4地址(内网地址),端口:whistle默认的8899

image-20200920181835993
  • 查看代理url信息

    image-20200920182126137