2

I am looking for a way to intercept all the HTTP requests between docker containers, for debugging purposes.

I am using MitmProxy and I can intercept the requests done from the containers to the internet (configured the HTTP_PROXY and HTTPS_PROXY environment variables), but not the ones done internally to other containers in the network (Using their DNS name).

Is there any way I can achieve that with MitmProxy or any other tool?

My idea is that if I have a Microservices application running locally, having a way to see all the requests between applications without needing to modify application code, would be a great way to debug communication issues between the services.

brpaz
  • 3,618
  • 9
  • 48
  • 75
  • What is your operating system? Are you doing both http and https? – jabbson May 23 '21 at 15:30
  • Linux (Fedora 33). Was testing with http. would want to have it working with https eventually, – brpaz May 23 '21 at 17:25
  • I found this article, (https://byteplumbing.net/2018/01/inspecting-docker-container-network-traffic/). Maybe I have to run Mitmproxy and transparent mode. Would like to avoid messing too much with Network configurations for just casual debugging sessions if there is another way. – brpaz May 23 '21 at 17:28
  • I was about to ask if you can try to bind mitmproxy to the docker0 interface, and asked for the OS to know if you have the docker0 interface. – jabbson May 23 '21 at 17:41

1 Answers1

2

You can intercept calls between containers using PnTest which uses mitmproxy under-the-hood but automatically re-configures your containers to route all outbound traffic through a proxy.

Evan Rolfe
  • 151
  • 1
  • 10