mitmproxy icon indicating copy to clipboard operation
mitmproxy copied to clipboard

Slow SSL Handshakes

Open Calpicow opened this issue 11 years ago • 1 comments

I'm using HAProxy to connect to a mitmdump reverse proxy in https2http mode. I'm seeing an additional 200ms+ latency for every request, which disappears when I set the proxy back to http mode. HAProxy opens and closes the connection for every request, so I highly suspect it's related to opening an SSL connection.

Right now I'm substituting http2http mode with Nginx to do SSL and proxy pass to mitmdump, and performance is good.

Below is a snippet of HAProxy configuration:

listen test ssl crt test.pem
    bind *:443
    mode http
    balance roundrobin
    server test localhost:443 check ssl verify none

Calpicow avatar Jul 14 '15 17:07 Calpicow

Hi there,

There are some circumstances in which mitmproxy has to make two upstream SSL requests, and discard the first one. Please have a look at the "How mitmproxy works" page in the documentation, specifically the section on SNI, for the somewhat complicated details:

https://mitmproxy.org/doc/howmitmproxy.html

I'd also expect some overhead due to the extra SSL negotiation, even in the best case. So, I don't believe this is a bug per se - please drop by the developer Slack if you feel the performance situation here needs to be improved.

Cheers,

Aldo

cortesi avatar Aug 16 '15 23:08 cortesi