/ Server

TIL: Snooping on a local connection

Snooping on an iOS simulator hitting a server running on localhost has always been a thorn in my side. With macOS Sierra tools have once again changed and I've once again solved this problem using a neat little tool called mitmproxy.

  1. Install mitmproxy - via homebrew

brew install mitmproxy

  1. Edit your /etc/hosts to add a local domain if you haven't already:

sudo vi /etc/hosts
add 127.0.0.1 l.local to the bottom.

  1. Reload your etc/hosts

sudo killall -HUP mDNSResponder

  1. Launch mitmproxy on the port (-p) the simulator is configured to hit, redirecting (-R) to the port your application is running locally.

mitmproxy -p3000 -R http://l.local:5000

See the requests and responses populate the mitmproxy!

TIL: Snooping on a local connection
Share this