Open mcfearsome opened 3 years ago
It doesn't support Https MITM 👍
By default only http
traffic is handled by these OnRequest/OnResponse handlers, while https
traffic will pass through untouched.
Depending on what you like to do on https connections, you might want something like AlwaysMitm
or AlwaysReject
.
So to explain why the snippets doesn't work:
In the first snippet, the proxy server is not yet configured to act on a https connection (as described above). Therefore, when visiting a site with https, the handler function is never called; If you visit a site without https, the information is expected to be logged.
In the second snippet, the var handler goproxy.FuncHttpsHandler
you defined returns an empty string as the host
, which is invalid for a CONNECT
request, and that prevents the normal browsing.
(There are some examples available for reference in the examples
directory and I would suggest checking out some of them.)
Should this issue closed, if the answer suffices @mcfearsome ?
The following code snippet does not produce any output, proxy behavior is working just fine, DoFunc just never gets called.
The following produces some output, but the proxy behavior breaks, as in I can't browse anymore: