What proxy mode do I need?

Hey guys. I find myself unable to directly identify what mode of proxy do I actually need. I am torn between transparent proxy and upstream proxy.

So here’s the deal: I am testing poor connectivity with the client-server application, which sends out websocket traffic. I cannot configure the client (except setting the server’s URL and port) so it rules out the regular proxy mode. The server and the proxy both run on my local computer.

I thought transparent proxy would be the choice to go as I have access to the client platform (it runs a flavour of Ubuntu) and I can route the outgoing traffic through the proxy.

Upstream proxy looks like an option too, because I can flat out configure the client to send all the traffic to the proxy and have proxy forward it to the server.

I need MITM injection because I want to kill off TCP connections between the client and the server every now and then to simulate connectivity issues.

Could I ask for advice, please?

Hi,

I’m not sure why you’re considering an upstream proxy here - upstream mode is pretty much regular mode but with a second proxy after mitmproxy, so if you rule out regular mode you can kind of also rule out upstream mode.

I think you actually either want a transparent or a reverse proxy. If you can even set the server URL and port, reverse proxy seems to be the natural fit here. Assuming your server runs on port 80, you can just run mitmproxy --mode reverse:http://localhost:80 -p 8080 (using 3.0 syntax), and then connect to your machine on port 8080.

Even if you cannot configure the server URL, reverse proxy is often a bit easier to configure as you don’t need to be careful to preserve the original destination when redirecting traffic.

TL;DR: If you only have one server, I definitely recommend reverse proxy mode.

1 Like

Sweet, thanks! I’ll try it out tomorrow.