解决charles无法抓取localhost数据包

我们有时候在本地调试的时候,使用charles抓取向本地服务发送的请求的,发现无法抓取。

charles官方也作了相应说明:

大概意思就是 某些系统使用的是硬编码不能使用localhost进行传输,所以当我们连接到 localhost的时候,不能被charles 抓取。

解决方法

使用 http://localhost.charlesproxy.com/ (charles启动后 localhost.charlesproxy.com 默认会指向127.0.0.1)代替 http://localhost/。

如果不想使用限定地址http://localhost.charlesproxy.com/ ,也可以在 hosts文件中配置: 127.0.0.1 xxx.test.com

案例

如抓取postman 请求本地接口的包,如下:

1、设置postman proxy指向系统代理:

2、使用 http://localhost.charlesproxy.com/ 代替localhost:

3、查看抓包结果:

可以看到抓包成功

相关推荐
七爷不在我这里7 天前
charles 抓取https<仅web端>
前端·网络协议·https·charles
lilili啊啊啊1 个月前
常用抓包工具tcpdump、Fiddler、Charles、Wireshark 和 Sniffmaster 下载地址
fiddler·wireshark·抓包·charles·sniffmaster·抓包大师·抓包工具下载
iDestin2 个月前
解决 chls.pro/ssl 无法进入问题
前端·代理·charles
lilili啊啊啊2 个月前
Fiddler、Charles、Wireshark 和 Sniffmaster 工具对比
fiddler·wireshark·charles·嗅探大师·sniffmaster
北京_宏哥2 个月前
《爆肝整理》保姆级系列教程-玩转Charles抓包神器教程(7)-Charles苹果手机手机抓包知否知否?
ios·前端框架·charles
又起风了3 个月前
Mac charles报错 invalid keystore format
macos·charles
&1=14 个月前
Charles简单压力测试
压力测试·charles
Wuxiaoming1355 个月前
charles抓包flutter
flutter·抓包·charles
勤奋的小王同学~6 个月前
(Charles)如何抓取手机http的报文
测试工具·charles
EQ-雪梨蛋花汤6 个月前
使用Charles对安卓手机进行抓包
android·charles