I am trying to block requests to anything over HTTPS
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.
The following code will print the URL when the request from the browser requests over HTTP, but over HTTPS I see nothing.
Any ideas why??
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
}
EDIT: I just read about HTTPS CONNECT
and perhaps that is how I need to handle the fact that an HTTPS request is made. The goproxy library seems to have HTTPSHandler()
and HijackConnect()
available, although I don't want to MITM the connection, I just want to block it.
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.
Also, do I need to 'listen' differently?
HandleConnectFunc()
or something?