I'm building an app (android + iOS) that needs to be able to reach an API Endpoint through a https proxy.
The development environment is Android Studio + Xcode + macOS.
My development path is:
Reach the endponit using android emulator settings.
Reach the endpoint using real andorid device settings.
Reach the endpoint using inapp solution implenting the https proxy connection management inside the app.
Since I'm at the first point, my problem is that I'm not able to setup the Android emulator with the https proxy.
(For iOS app, just setting up the mac network preferences is enought)
In Android, I successly set up the http, but not the https.
I have tried setting up the apn at the vitrual device, and running the emulator with -http-proxy.
According to the documentation it includes https proxy, but it still not working.
The debugger saids that the server response is null when calling https. Http redirects to https.
All of those solutions just works for the http, not for the https.
I have also tried whit genymotion with no success.
I have tested the API from my computer (via postman) and it is all ok.
Has anyone been able to successfully access an https proxy from the Android emulator? It's possible? What settings am I omitting?
Thank you so much in advance.
PS: My problem is related with HTTPS, I am able to use HTTP proxy
Related
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:
A localhost development Spring server running on my Mac OS
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:
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:
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:
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.
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.
I have done all the configuration in Jmeter and my Android device. For configuration , I have refereed the below link:-
http://community.blazemeter.com/knowledgebase/articles/186249-load-test-mobile-apps-easily.
The issues is, while performing the steps on the native application (On Android phone) I am not able to capture 'HTTPS' traffic in Jmeter. I also installed the Jmeter certificate on my Android phone. Please help me to resolved above problem.
Note: I am able to capture the HTTP request through Jmeter.
It look like you "referred" the link not very attentively. It states:
Note that Android supports only HTTP proxy. If your application uses an HTTPS connection, then you may use an additional application that performs with HTTPS proxing.
For instance it looks like ProxyDroid application does
Support HTTP / HTTPS / SOCKS4 / SOCKS5 proxy
For a project working I need to inspect the HTTP requests sent and received from my Android device. I'm using this tool Fiddler2 to monitor the traffic. In order to get it working I had to pass the traffic through a proxy. Now my phone is a Huawei U8180. Its runs Android 2.2 so it doesn't have a direct way to proxy settings. I used this app called Proxy Settings to gain access to set the proxy settings.
It almost works. I can see the traffic say, if I navigate to a website using the proxy web browser in that app (The app comes with a proxy browser). But not using my phone's normal browser. Neither I can see any HTTP requests sent by any of my apps installed in my device.
If anyone has any experience using Fiddler2 with Android, I'd really appreciate your input. I'm open to try any other alternatives to accomplish this if you got any.
Thanks.
Typically, Android users will use a tool like iptables to capture traffic from apps that don't support a proxy setting. This has some implications for HTTPS decryption; see the Fiddler Discussion Group (Help > Fiddler Community) for discussion of how to adjust Fiddler's HTTPS settings to accommodate iptables-redirected HTTPS connections.
I have an android application that makes a https connection to a backend. I have successfully added the required certificate (obtained from the backend and converted to bks format) and the app can connect when running on 2.2, 2.3 and 4.0.2 emulators. However on my huawei u8860 (honor) with ics 4.0.3, the app doesn't connect and worst of all it doesn't give any exceptions in the log. On the phone also, I can't point the native browser to the backend but i can using google-chrome for android. I've searched high and low on but found no explanation for this behaviour. any ideas?! Thanks in advance
I suspect the problem is caused by your mobile carrier.
Some of them perform nasty filtering of HTTP requests, based on the User-Agent header (they'll block requests that do not seem to come from a mobile device).
You should try your app on your phone, using a Wifi connection to confirm/infirm this hypothesis.
If it works on Wifi, you should try to change the User-Agent of your HTTP requests, by either setting it to:
A hard-coded Android Chrome or iPhone Safari User-Agent (that you carrier probably does not block)
The User-Agent of your own device's browser that you should get with getUserAgentString()
I'm at complete odds over configuring a proxy to inspect the HTTP(S) traffic for the app I'm developing. I've tried running Fiddler2 and Charles Web Proxy, both run on 127.0.0.1:888, and starting up the Android emulator with the parameter:
-http-proxy http://127.0.0.1:8888
To test it out I open the Android browser. I see in Fiddler2 that the request is routed through the proxy. However, only RARELY does the request receive a successful response. In most, and when I say most I mean 99% of the time, the request is retried and fails again with the Android browser telling me "The server failed to communicate".
Has anyone found a way to configure Fiddler2 or Charles for debugging HTTP(S) traffic through the Android emulator?
The -http-proxy emulator option works for me (with a real HTTP proxy behind it), so not sure what the problem with Charles would be.
An alternative is to capture the network traffic directly, then analyse it afterwards using Wireshark — which can do SSL decryption, if you have the private key.
I was able to view the traffic with an HTTP sniffer instead of a proxy. I used HTTPScoop, which is a nice little app.
Also the nice thing about using HTTPScoop is that I can also see traffic on my actual device when I turn on internet sharing and have my phone use the wifi from my mac. So this is a good deal for debugging what happens on the phone itself AND the emulator.
This way it doesn't matter what emulator you use, because the sniffer sees the traffic independent of the emulator, device, compiler settings etc.
I had the same problem with Charles using the Emulator from the Android development tools r12. It should be working when you download r11 and replace the emulator in r12 with the one from r11. The bug is tracked here.
To get r11 copy the download link from the download page and change r12 to r11.