omjadas / hudsucker

Intercepting HTTP/S proxy
https://crates.io/crates/hudsucker
Apache License 2.0
211 stars 37 forks source link

[Feature] Selective MITM #6

Closed zu1k closed 3 years ago

zu1k commented 3 years ago

When using the proxy provided by hudsucker, all https requests will use the certificate issued by hudsucker. However, usually most of our requests may not need to be processed through hudsucker, so I suggest adding some option for selective MITM.

My idea is that the user of your crate could pre-provide a list of hosts and only mitm requests corresponding to the hosts in that list.

Or a more flexible way, let the user provide some kind of judgment method closure, and pass in the req to determine if it should be forwarded directly or need to mitm.

I believe that selective mitm will improve the overall performance when using hudsucker's proxy.

omjadas commented 3 years ago

If this is mainly for a benefit to performance, I think there should be some benchmarks performed first and if the benefit is negligible or minimal then it would probably not be worth it for the added complexity. I have been meaning to do some performance testing, but have not had the time to get around to it yet.

omjadas commented 3 years ago

I have done some performance testing and was unable to determine a noticeable impact on performance (when using the no-op handlers). In light of this (and the fact that a good portion of applications will support a no_proxy setting themselves), I will close this feature request.