title: GoProxy SSL interception in golang
body: <p>I am trying to block requests to anything over HTTPS</p>
  
  <p>It works perfectly for HTTP, however HTTPS seems able to completely avoid my proxy. I am using foxyproxy in firefox to set it to use my proxy.</p>
  
  <p>The following code will print the URL when the request from the browser requests over HTTP, but over HTTPS I see nothing.</p>
  
  <p>Any ideas why??</p>
  
  <pre><code>func DropHTTPS() net.Listener {
      listener, _ = net.Listen(CONN_TYPE, CONN_HOST+":"+CONN_PORT)
      proxy := goproxy.NewProxyHttpServer()
      proxy.OnRequest().DoFunc(func (req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
          log.Println("url: ", req.URL)
          return req, nil
      })
      go http.Serve(listener, proxy)
      return listener
  }
  </code></pre>
  
  <p>EDIT: 
  I just read about <code>HTTPS CONNECT</code> and perhaps that is how I need to handle the fact that an HTTPS request is made.
  The goproxy library seems to have <code>HTTPSHandler()</code> and <code>HijackConnect()</code> available, although I don't want to MITM the connection, I just want to block it. </p>
  
  <p>EDIT AGAIN:
  This code, seems to run the HTTPS proxy on a different port to HTTP. Im not sure if this needs to be configured in Firefox, or my proxy can just listen on one port for both HTTP and HTTPS.</p>
  
  <p>Also, do I need to 'listen' differently?</p>
  
  <p><code>HandleConnectFunc()</code> or something?</p>