node-mitmproxy icon indicating copy to clipboard operation
node-mitmproxy copied to clipboard

关于node-mitmproxy在Android手机端访问https的问题

Open zimo2013 opened this issue 7 years ago • 3 comments

http没有问题,部分https返回正常,但部分https会报错,错误如下

(node:19245) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot read public key. OID is not RSA.

//js 配置如下 sslConnectInterceptor: (req, cltSocket, head) => true, caCertPath: '/Users/mac/node-mitmproxy/node-mitmproxy.ca.crt', caKeyPath: '/Users/mac/node-mitmproxy/node-mitmproxy.ca.key.pem',

Android手机已经安装了对应的证书crt

zimo2013 avatar Mar 02 '18 06:03 zimo2013

@stackzhang ,会报错的https请求不用代理时用浏览器能否正常打开?

wuchangming avatar Mar 02 '18 06:03 wuchangming

@wuchangming 源生App里嵌套一个网页,这个网页中会有ajax网络请求,这个请求是https的,不知道是否可以拦截到。 我使用charles是看到了这个请求

我的需求,就是使用代理,获取部分接口的数据(http/https的),不修改任何数据。

zimo2013 avatar Mar 02 '18 07:03 zimo2013

@stackzhang ,是可以拦截的。 一些比较简单的拦截配置,可以参考: 拦截请求:https://github.com/wuchangming/node-mitmproxy/blob/master/example/config/requestInterceptorConfig.js 拦截响应: https://github.com/wuchangming/node-mitmproxy/blob/master/example/config/responseInterceptorConfig.js

wuchangming avatar Mar 02 '18 07:03 wuchangming