whistle前端开发代理工具使用入门

2021/5/14 10:59:34W2_Whistle代理

官网:http://wproxy.org/whistle/
github: https://github.com/avwo/whistle

whistle(读音[ˈwɪsəl],拼音[wēisǒu])基于Node实现的跨平台web调试代理工具,类似的工具有Windows平台上的Fiddler,主要用于查看、修改HTTP、HTTPS、Websocket的请求、响应,也可以作为HTTP代理服务器使用,不同于Fiddler通过断点修改请求响应的方式,whistle采用的是类似配置系统hosts的方式,一切操作都可以通过配置实现,支持域名、路径、正则表达式、通配符、通配路径等多种匹配方式,且可以通过Node模块扩展功能

1,全局安装
npm安装方式:

$ npm install -g whistle

yarn安装方式:

$ yarn global add whistle

2,启动服务:默认配置地址:http://127.0.0.1:8899

$ w2 start

重启服务:

$ w2 restart

停止服务:

$ w2 stop

3,代理配置:

# 域名匹配
 www.example.com
 # 带端口的域名
 www.example.com:6666
 # 带协议的域名,支持:http、https、ws、wss、tunnel
 http://www.example.com

 # 路径匹配,同样支持带协议、端口
 www.example.com/test
 https:/www.exapmle.com/test
 https:/www.exapmle.com:6666/test

 # 正则匹配
 /^https?://www\.example\.com\/test/(.*)/ referer://http://www.test.com/$1

 # 通配符匹配
 ^www.example.com/test/*** referer://http://www.test.com/$1