支持HTTP、HTTPS、WebSocket,HTTPS采用动态签发证书,可以拦截http、https的报文并进行处理。
例如:http(s)协议抓包,http(s)动态替换请求内容或响应内容等等。
需要导入项目中的CA证书(src/resources/ca.crt)至受信任的根证书颁发机构.
new NativeHttpProxyServer().start(9002);
new NettyHttpProxyServer().start(9001);
//拦截处理
new NettyHttpProxyServer().initProxyInterceptFactory(() -> new HttpProxyIntercept() {
@Override
public boolean afterResponse(Channel clientChannel, Channel proxyChannel, HttpResponse httpResponse) {
//拦截响应,添加一个响应头
httpResponse.headers().add("intercept","test");
return true;
}
}).start(8999);
SSL握手
HTTP通讯