Mixing transparent mode and upstream mode

Hi, I am setting up an internet gateway that runs e2guardian with sslmitm mode enabled. What I want to do is setup the gateway machine to transparently redirect HTTP and HTTPS requests to the instance of e2guardian running on port 8080. Mitmproxy would be the entity that does the redirection, hence the mixing transparent and upstream mode. I have been using iptables nat’ing rules to catch all port 80 and 443 traffic and redirect it to on the gateway machine where mitmproxy is listening, mitmproxy however can only forward or intercept but not both. Is what I am trying to do even possible using mitmproxy? Finally, not trying to sound harsh, but to anyone who thinks this can’t be done at all, please take a look at proxy.py. This is code I wrote (heavily modified really) as a proof of concept test. Thanks

If I understand you correctly, you are just looking for a tool that transparently wraps connections and tunnels them through an HTTP proxy. There are a few dedicated tools to do this, e.g. redsocks - how about using one of those?

You have understood me correctly, and actually I had already found redsocks but I couldn’t manage to get it working. It would always accept my connection but then never complete and eventually the connection would timeout. I found one or two other programs that seemed to be able to do HTTP CONNECT tunneling but I was not able to get them working either. Could you please give me a list of the tools you are aware of?