Reputation: 16622
I would like to use Charles web proxy to work with the Android emulator in Windows. I've successfully set up charles and have started the emulator with the command line:
emulator -http-proxy 127.0.0.1:8888 @NexusOne
I can see traffic coming from the android emulator in Charles, but the problem is that I'm developing against a live API which uses SSL and I'm not sure how to configure Charles to let me play about the the data which is sent and received. I'm aware of two areas where SSL is set up in Charles (Proxy -> Proxy Settings -> SSL and Proxy -> Client SSL Certificates) but I can't find any decent documentation which has let me do what I want to do. Has anyone experience with Charles, or certificates in general, who can explain how to achieve this. Maybe a primer on certificates would be good too, as I seem to be lacking knowledge as to why this is so difficult.
Upvotes: 66
Views: 171275
Reputation: 18284
The certification installation step whatever mentioned here is correct https://stackoverflow.com/a/35200795/865220
But if you are having a pain of individually having to enable SSL Proxy for each and every new url like me, then to enable for all host names just enter * into the host and port names list in the SSL Proxying Settings like this:
Upvotes: 2
Reputation: 1477
To remotely capture http or https traffic with charles you will need to do the following:
HOST - Machine running Charles and hosting the proxy CLIENT – User’s machine generating the traffic you will capture
Host Machine
Client Machine:
When I tested this out I picked up two lines of a Facebook HTTPS chat (one was a line TO someone, and the other FROM)
you can also capture android emulator traffic this way if you start the emulator with:
emulator -avd <avd name> -http-proxy http://local_ip:8888/
Where LOCAL_IP is the IP address of your computer, not 127.0.0.1 as that is the IP address of the emulated phone.
Source: http://brakertech.com/capture-https-traffic-remotely-with-charles/
Upvotes: 76
Reputation: 996
These things helped me
Hope this helps someone out there.
Upvotes: 0
Reputation: 548
In Charles, go to Proxy>>Proxy Settings and select the SSL tab. Add your host to the list of Locations.
For example, if your secure call is going to https://secure.example.com, you can enter secure.example.com, or *.example.com.
Once the above is in place, you may need to right-click on the call in the main Charles window and select the SSL Proxying option.
Hope this helps.
Upvotes: 50
Reputation: 9983
Things have changed a little in the way Charles provides HTTPS proxying.
First the certificates installation options have been moved to the help menu.
Help -> SSL Proxying -> Install Charles Root Certificate
Help -> SSL Proxying -> Install Charles Root Certificate in iOS Simulators
Second, starting in iOS 9 you must provide a NSAppTransportSecurity
option in your Info.plist
and if you want Charles to work properly as a man in the middle, you must add:
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
as part of the your domains see full example:
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
The reason being (I guess) that Charles at some point communicates in clear http after acting as the man in the middle https server.
Last step is to activate SSL Proxying for this domain in Charles (right click on domain and select Enable SSL Proxying)
Upvotes: 24
Reputation: 4078
For what it's worth here are the step by step instructions for doing this in an Android device. Should be the same for iOS:
You should then be able to see the SSL files in Charles. If you want to intercept and change the values you can use the "Map Local" tool which is really awesome:
Upvotes: 27
Reputation: 71
What worked for me - should really be moved to iPhone:
Charles
Mac
iPhone
Voila, you can now view encrypted traffic from the domain added in the SSL proxying
Upvotes: 7
Reputation: 2533
You should also click on "Install Charles CA SSL Certificates.." from the Charles Help menu. See more detailed instructions at http://blog.noodlewerk.com/general/tutorial-using-charles-proxy-to-debug-https-communication-between-server-and-ios-apps/
Upvotes: 7