Listen to and redirect outgoing Http/Https requests

I’m trying to make a GoLang program, that logs every outgoing http/https request when it runs on the computer, for example, when it’s running it on my computer, when I open a browser and open, it logs it. An appreciated extra would be a way to redirect some unwanted website requests (like a parental control)

I’ve been trying and looking all around and it seems that all the examples out there consider the computer where the Go exe is running as a server… That’s not what I want

Thank you very much

I guess what you are looking for is an HTTP proxy server. This is a program that is both a server (for your Web browser) and a client (for the server the browser wants to connect to). When you set the Proxy settings of your operating system to that proxy server, your browser will send every request to the proxy server instead of the real target server. The proxy forwards the request and also passes the response on to the client.

There are a couple of HTTP proxies readily available (Squid and Fiddler come to mind), and most of them should have built-in logging, so you don’t need to write your own proxy server for that purpose.

If you want to write your own HTTP proxy for learning purposes, I’d suggest starting by searching GitHub for language:go http proxy and inspecting the code of a few of these, to see how they are doing it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.