某日我儿(前端 ios 使用 https 但是没有强制)问我如何利用 charles 来代理后端本地 API 测试,我直接甩给他 map remote 大法 (from https to http),解决。
思考
这时候我觉得 charles 类似 QuantumultX 直接重写响应 payload,但是看了 doc 之后发现仅仅只是转发。然后我问了下我儿,他说他客户端没做 ssl 校验,那么之后排期做了校验这种方式可能会有问题。
这时我就想到能否利用 charles 的 rootCA 来自签,这样的话配合 DNS 和一些 web server 反向代理就能做到直接本地 https 线上域名访问了(当然 client 添加公钥这种问题就不在这里赘述了)。
实验
首先先导出 charles 的 CA 和 私钥
Help > SSL Proxying > Export Charles Root Certificate and Private Key...
前情
某日我儿(前端 ios 使用 https 但是没有强制)问我如何利用 charles 来代理后端本地 API 测试,我直接甩给他
map remote
大法 (from https to http),解决。思考
这时候我觉得 charles 类似 QuantumultX 直接重写响应 payload,但是看了 doc 之后发现仅仅只是转发。然后我问了下我儿,他说他客户端没做 ssl 校验,那么之后排期做了校验这种方式可能会有问题。 这时我就想到能否利用 charles 的 rootCA 来自签,这样的话配合 DNS 和一些 web server 反向代理就能做到直接本地 https 线上域名访问了(当然 client 添加公钥这种问题就不在这里赘述了)。
实验
首先先导出 charles 的 CA 和 私钥
Help > SSL Proxying > Export Charles Root Certificate and Private Key...
然后转成
PEM
^1 (charles-ssl-proxying.p12
newfile.xx.pem
按实际情况填写)然后参考
创建(这里假如使用的是 example.com 网站) 1、server.csr.cnf
2、v3.ext
执行
获得
使用 caddy 简单做一个反向代理
然后在 charles 中配置
Tools > DNS Spoofing
将
example.com
指向本地 caddy,这样就能直接请求了 (当然直接改 host 也是可以的)PC:
Android: