Im trying to create a local windows MITM proxy with C# to deal with a now unsupported application from a company that no longer exists.
The Proxy has to only service one HTTPS domain which is being done by creating a proxy that listens on the local address:port 127.0.0.1:443.
An entry in the host file is then created i.e. 127.0.0.1 my.single.domain.com.
If I was to connect to this with a browser using its own proxy setting and having no host entry, the browser will send a "CONNECT...etc" to the proxy.
There are many examples for this and I can get this to work fine from these examples. (Titanium.Web.Proxy etc).
When using a host file as described above the ssl/tls handshake is initiated immediately rather than a "CONNECT....etc" being sent. This is because the browser now rightly believes that 127.0.0.1 is the actual server.
Im really stuggling to find a good example of how to deal with this using the C# SslStream option. Most are for simple client server demos and frankly most dont work including MSDNs own examples.
My specific requirement is a browser navigating to
URI: HTTPS:\\my.single.domain.com\ but no other domain to use this proxy so use the host file. (A port forwarder isnt being used because of reasons out of my control)
Where I am able to intercept (MITM) the passing data.
Do I have to create two SslStream connections now?? One to deal with the browser and then a second one to deal with the server.
Just a good basic example would be cool :-)