I am currently creating a proxy server in C #.

I was able to confirm that the http address correctly behaves as a proxy server,
Could not receive access to the https address.

The receiving part is as follows

Create HttpListener

HttpListener listener = new HttpListener ();
listener.Prefixes.Add ("");
listener.Start ();
listener.BeginGetContext (this.OnRequested_ClientToProxy, listener);

HTTP request receiver

      public void OnRequested_ClientToProxy (IAsyncResult result)
                HttpListener listener = (HttpListener) result.AsyncState;
                HttpListenerContext context = listener.EndGetContext (result);

■ Problem reproduction procedure
1. In Client, set proxy settings to HttpListener address and port number
2. Run the above program on the server
3. Access https://www.google.com/ using IE with Client.
4. The HTTP request receiver function is not called.

If anyone knows how to set it, please let me know.

  • Answer # 1

    I solved it with a hint of dodox86.
    HTTPListener did not support the Connect method.
    Just in case, Get, Post, etc. seem to be supported.

    I was able to detect the connection using TCPListener to catch Connect.
    It seems that you can read SSL communication if you use the proof.