[英]Unable to view HTTPS requests in Charles Proxy with Android
[英]Charles Proxy + Android HTTPS
所以这里有一些类似但过时的答案,它们可能在几年/几个月前对我有所帮助:
为什么我在 Charles Proxy 上看不到 Android 版 Chrome 浏览器的 http 或 https 流量?
我遵循了所有说明,我可以很好地读取 http 请求,但不能读取 https 请求。 仍然无法弄清楚我做错了什么。 由于我刚刚遵循了上述指南,因此我没有太多要发布的内容。
我认为主要问题是如何强制我尝试调试的应用程序使用我的证书? 清单修改似乎不起作用。
请参阅此问题,其中更新了 Charles 4 和 Android 7 的答案。
您必须从 Charles 帮助菜单安装证书,并且必须使用 Settings -> Security -> Install from storage on device。
您的应用需要 network_security_config.xml
您必须使用可调试的应用程序
对于那些寻找更新的 Android 版本(8、9、10 或 ++)+ CharlesProxy 4.6 的人
可以参考本指南...
从 Android N+ 开始,它需要额外的步骤才能工作。
1.将 res/xml/network_security_config.xml 添加到您的项目中。
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</debug-overrides>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config>
<!-- Make sure your URL Server here -->
<domain includeSubdomains="true">your_production_domain</domain>
<trust-anchors>
<certificates src="user"/>
<certificates src="system"/>
</trust-anchors>
</domain-config>
=> 确保将 your_production_domain 替换为要拦截的域
2.添加到AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
<application android:networkSecurityConfig="@xml/network_security_config" ... >
...
</application>
</manifest>
如果你不能让它工作,你可以查看示例代码,其中包含所有配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.