Binding Mockttp to use specific IP on NIC to send to send out request

43 Views Asked by At

I've been checking Mockttp for MITM HTTPS traffic capture available here, and I'm trying to figure out if it there is a built-in way to force it to use an specific IP on NIC to send out the requests. For my use case I have 3 clients (iPhones) connected to a server (Linux) with 3 IPs, the clients have been configured to use Mockttp as proxy running on the server, Mockttp listens to port 8000 and the clients point to the default IP on the server (which is actually irrelevant since all 3 IPs are public). Once the clients have stablished a connection to the proxy and start sending requests those are just being passed through to the final end-points via Mockttp but at that moment all end-points see the traffic as is comes from a single IP. The idea is to have the end-points see the traffic as it comes from different clients (3 different IPs), therefore the ask if it is possible to force Mockttp to use a different outgoing IP for each client.

For this purpose using X-Forwarder-For header is not a solution because that's only intended for web server application layer, the other end will still see the same IP at transport layer. The solution would be to bind Mockttp to a specific IP before sending the request so I'm trying to find out if there's already a provision for this built into the library or if it'll require a custom implementation.

I found what seems to be an alternative solution here that I still need to test but that would involve running multiple instances of Mockttp because it involves isolating each process to restrict the use to specific resources like NIC/IP, it also requires to config each process separately which makes scalability more complex (yes I might add more clients in the future).

0

There are 0 best solutions below