Kodeco Forums

Charles Proxy Tutorial for iOS

Learn how to intercept, inspect, and modify network requests with Charles Proxy to debug your iOS networking code or to take a peek inside other apps!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/641-charles-proxy-tutorial-for-ios

Great article! I stumbled over an issue installing the certificate on iOS 10.3.
You can find a solution here:
https://www.neglectedpotential.com/2017/04/trusting-custom-root-certificates-on-ios-10-3/

1 Like

Great article! Similar to Charles Proxy, there is Wireshark. It has a lot of features, which includes proxy.

https://www.wireshark.org

I use both but for some reason I prefer Charles Proxy over Wireshark for app stuff.

Thanks for that, @markuswinkler! I’ll see about getting the tutorial updated to reflect that.

Hi,

My first post here on the forums and hoping you can help. I’m sure I’m just missing something obvious.

I’m going through the tutorial and feel like I’ve done the steps, but here is what I’m running into.
I have an app that I have in the iOS simulator.
It uses https for the api calls.
I’ve included the url in the charles proxy settings and have installed the cert.

However, when I go to use my app now (with Charles running) in the simulator. I can’t log in. It won’t connect. It almost seems like having Charles on is blocking the https://… call.

Appreciate your help.

For any HTTPS traffic, you need to set up Charles SSL proxying, which was covered briefly in the tutorial - Go to the “Proxy” menu, then “SSL Proxying Settings…”. From there add an entry with your hostname and port 443 - after that Charles will properly forward the HTTPS call (which is also why you need to install the certificate, so the HTTPS call can connect to the Charles proxy). That’s usually what is wrong (that or the certificate is not installed) when HTTPS calls fail with Charles.

Excellent tutorial @astralbodies :slight_smile:

I’m the developer of a native intercept and debug tool for macOS and iOS called “Peek”. Check it out here: https://peek.tools (macOS) and Connecting to the iTunes Store. (iOS). The iOS app allows you intercept on the go, without a Mac. If you want to try it out and want a promo code: PM me or DM twitter: @inter_cept Always happy to receive suggestions :slight_smile:

I’ve done what you’ve said here but still nothing. I can’t log into my app when I have Charles running. The error I get in Xcode is.
Task: <__NSCFLocalDataTask: 0x7fbbec90ba30>{ taskIdentifier: 1 } { completed } completed with error: An SSL error has occurred and a secure connection to the server cannot be made.

If I close Charles it works fine. Not sure why…

Thanks for this tutorial, so far so good!

Although I didn’t have an error installing Charles SSL Certificate, I had the following problem after enabling SSL Proxying for api.winderground.com. After that, refreshing the app by pulling down caused the CONNECT request to fail with:
Failure No request was made. Possibly the SSL certificate was rejected.

The solution is to follow the instructions mentioned in the tutorial for iOS 10.3:
Navigate to Settings > General > About > Certificate Trust Testings and turn the switch on for Charles certificate.

Hey there @dariojg! iOS 10.3 introduced some security changes that I noted in the tutorial recently. You’ll have to accept the Charles Proxy certificate as valid by following these instructions - Trusting Custom Root Certificates on iOS 10.3 – Neglected Potential

Let me know if this solves the issue!

Thanks for sharing this useful guild with us. By using a private dedicated proxy you can stay anonymous in any browser. For more information about the proxy server, you can visit: https://microleaves.com/

Thanks for the tutorial. I’ve used charles a lot.
But nowadays is iOS 10 with http2. How to use charles with http2.
I was able to setup according Browser & System Configuration • Charles Web Debugging Proxy but I see requests and reponses like this:
>�]�˻�}ƆO��nn�o_a���/�.70�2���ƌ�'s �i�x��v� �tZ�����~��47�5��˾��5�C�%Ī�����+�FU�m���f�=&�a�r�;��Q�D��a�}A���� [�[�O��DzŘ��\���:Mx�*t�Bʊ����/��y����z�����Z��"լ����2c̷V�#��5��q"�C��֘���[j}

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]