Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging iPhone traffic using Charles Proxy Socks feature?

I'm trying to use Charles Proxy in order to debug some performance issues on my iPhone. I got it all working using the "http proxy mode", but fail to do so with the "socks proxy mode". Since iOS exhibits different behavior under http proxy than in real life (see http://www.charlesproxy.com/documentation/configuration/proxy-settings/), I would really like to make the socks proxy work.

After configuring the socks proxy on my iPhone, I fail to connect to any site, and sniffing on the machine that runs Charles shows that I get a reset whenever I'm trying to connect. What step am I missing?

An explanation on how to make it work on either Mac or Windows would be much appreciated!

like image 773
r0u1i Avatar asked Jun 06 '11 06:06

r0u1i


People also ask

How do I use Charles Proxy on my iPhone?

Now, open the Settings app of the iPhone device and navigate to "General" >> "About" >> "Certificate Trust Settings". Find the downloaded "Charles Proxy CA" certificate, then tap on it and switch it on to enable full trust for it.

What is Charles Web Debugging Proxy?

Charles Web Debugging Proxy is a cross-platform HTTP debugging proxy server application written in Java. It enables the user to view HTTP, HTTPS, HTTP/2 and enabled TCP port traffic accessed from, to, or via the local computer.


2 Answers

Setting up a Socks Proxy for iOS with a PAC file

Fire up the Apache server on your Mac or somewhere on the net (A raw gist would work). Create a simple PAC file.

proxy.pac

function FindProxyForURL(url, host) {
   return "SOCKS <Address of Charles-The-Proxy>:<SOCKS port>";
}

Then point your iPhones proxy settings under the network connection to HTTP Proxy-> Auto-> http://<addressOfWebServer>/proxy.pac

Final note

Don't forget to undo your proxy settings when you're done.

like image 136
Cameron Lowell Palmer Avatar answered Sep 22 '22 13:09

Cameron Lowell Palmer


According to charles documentation: https://www.charlesproxy.com/documentation/configuration/browser-and-system-configuration/

Auto configuration

You can also supply an auto-configuration URL instead of entering manual configuration. This approach will enable your device to first try to use Charles, but then to fallback to using a direct connection if Charles isn't running. This is an experimental approach!

For the auto-configuration URL enter:

https://chls.pro/X.X.X.X.pac Where you replace X.X.X.X with the IP address of your computer running Charles. This defaults to port 8888. If you use a different port, just include that, e.g. https://chls.pro/X.X.X.X:XXXX.pac

You can also use Charles in SOCKS proxy mode from iOS using an autoconfiguration rule, in spite of this not being available as a manual setting. Enter the auto-configuration URL as follows:

https://chls.pro/X.X.X.X:XXXX.socks.pac

like image 44
Ezimet Avatar answered Sep 20 '22 13:09

Ezimet