Every once in a while it becomes useful to be able to actually look at the network request that is leaving your device to understand why things aren’t working, or to gain insight into how other people’s things work. While tools for network debugging such as Wireshark are great and have existed since forever, Charles web debugging proxy was built specifically to make http requests very easy to debug.

How it works:

You —> Charles —> Internet

By sitting in between you and the Internet, Charles is able to pick up on every single network request that you send and receive. Once it picks up on some http requests, it shows you everything you need to know about it such as the headers in the request and the body of the response. It looks something like this:

Screen Shot 2016-04-04 at 10.23.26 PM

Screen Shot 2016-04-04 at 10.18.42 PM

Screen Shot 2016-04-04 at 10.18.45 PM

This works great for http or unencrypted content, but what about https? Luckily there’s ways around that as well. Without going into the details, by installing a certificate on the device you want to debug, Charles can provide the same functionality for encrypted connections as well. Let’s use the Shopkick app as an example.

Screen Shot 2016-04-04 at 10.31.00 PM

Trying to analyze the calls to https://app.shopkick.com doesn’t show any useful information because they’re encrypted over SSL. Let’s enable SSL Proxying.

Screen Shot 2016-04-04 at 10.31.08 PM

Screen Shot 2016-04-04 at 10.31.29 PMScreen Shot 2016-04-04 at 10.31.36 PM

And now we can see all that traffic in the clear.

Charles also allows us to copy the cURL command for a particular request. Let’s use this to simulate a login from the command line.

Screen Shot 2016-04-04 at 10.39.52 PM

Charles is great for debugging mobile apps which mostly only make use of http connections, however in order for this to work on a mobile device we need to configure the device to use our computer as a proxy. On iOS you can do this by going to the wifi settings and scrolling down to the HTTP Proxy section. Fill in the details to match your computer where Charles is running.

Once that is done, open safari and navigate to http://charlesproxy.com/getssl That will prompt you to install the Charles certificate and allow you to debug SSL connections coming from your device.

Happy debugging!

Categories: Networking

Raz

I'm 25 years old and I do stuff with computers.