Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Charles Proxy for Genymotion stops 10.0.3.2 localhost traffic

I read all the threads about this topic and the instructions for setting up charles with genymotion are all the same:

http://rexstjohn.com/using-genymotion-charles-proxy/

In your Genymotion Android emulator…
Settings -> Wifi -> Press and hold your active network
Select “Modify Network”
Select “Show Advanced Options”
Select “Proxy Settings -> Manual”
Set your Proxy to: 10.0.3.2 (Genymotion’s special code for the local workstation)
Set your Port to: 8888
Press Save

My set up is:

  1. A localhost development Spring server running on my Mac OS
  2. An android app installed on my genymotion emulator. The genymotion emulator communicates with my local dev server through ip 10.0.3.2 (How to access localhost from a Genymotion android emulator?)

I'm not sure if the instructions are old but the issue I'm having is that traffic that flows from my genymotion emulator is recorded within Charles Proxy but it is just not reaching my localhost server. I'm not using any SSL encryption between my server and my app.

This is my settings inside genymotion wifi screen:

enter image description here

This is what my Charles Proxy looks like - you can see that it is "Connecting to remote host". It connects forever and then eventually ends up giving me a 503 error on my android app side with nothing being returned:

enter image description here

If I switch off Charles Proxy, the app connects with my localhost server with no problems and all calls are returned successfully. I think it is something to do with Charles that is stopping my app from communicating with my localhost server.

In Postman, if I try to query the same url that my android app was trying to query, it works successfully and the results are also successfully logged within Charles:

http://localhost:8443/ + my api endpoint **OR** http://localhost.charlesproxy.com:8443/ + my api endpoint

The only difference between querying in Postman and querying in my android app is that my app hits this url 10.0.3.2 instead because I'm working off an emulator:

http://10.0.3.2:8443/ + my api endpoint

I have also added 10.0.3.2 into my Access Control Settings:

enter image description here

I can go into my android genymotion emulator internet browser and search for websites like www.msn.com and it will return successfully plus log the results within Charles but I'm not looking for or are prepared to pay 50 USD for a tool to record my android browser traffic. I need it to work with my android app so that I can debug my app. I'm not sure how to fix this, does anyone here know if I'm missing something?

EDIT:

In case someone is wondering, I have read this post on Charles' FAQ about Localhost traffic doesn't appear in Charles:

https://www.charlesproxy.com/documentation/faqs/

But it is not like I can change the 10.0.3.2 used by Genymotion to http://localhost.charlesproxy.com/ instead so I don't think that would solve my issue.

like image 802
Simon Avatar asked Apr 27 '16 15:04

Simon


1 Answers

So I was playing around with the Genymotion emulator and Charles now and I actually managed to get Charles to record localhost traffic.

Similar to the way I queried through Postman with:

http://localhost.charlesproxy.com:8443/ + my api endpoint

I just changed the host portion of all my api endpoints to: http://localhost.charlesproxy.com:8443/ and it worked.

like image 188
Simon Avatar answered Sep 19 '22 16:09

Simon