How to set up VPN with Charles Proxy for the phone to see the traffic of the phone
We all know our world is isolated from one country to the other country from Internet for some geo restrictions or political restrictions. And with all kinds of different reasons, we have to break the wall to access other country resource. For example, you are traveling to other country and you have to access back the original country resource for the time being, or your company outsource the jobs and employees have to test the job to see if it is working on the job requested country, etc.How to break the wall from Internet to access other country resource? The good thing is we have VPN which can help us to solve the problem. There are tons of info on Internet regarding how to set up VPN on your computer or phone. Here we show you how to set up VPN and Charles together to observe the traffic between client and server for testing purpose.
Given a situation, If a US based company outsources the developing job in India. When Indian team finish implementation and submit the app to US store, how do they know if this app is able to run successfully in US for the geo restriction? To solve this issue, we can set up a VPN with Charles proxy together for our phone to see if all traffic sent properly.
This video will show you how to set up a free VPN on MAC. For Windows platform, it would be the same concept to set VPN for the phone access. The difference is just how to set up a hotspot. Once VPN set up, then share this VPN with the hotspot that was set up in the Mac for the Charles Proxy to check all traffic between the phone and server. I will use a free VPN that was searched from Internet for our example here. If you obtained a VPN account from your company, then you can use it for your testing purpose instead. Let's see the video how it works on Mac:
Once VPN set up via a hotspot, the communication between client and server would be working in this way, first phone will send request to Charles via wifi, then Charles will sent request to server over the VPN set up on the Mac. Then you will see all traffic between client and server. Of cause I assume you already have SSL certificate installed in order to check the communication over HTTPS as well. Here I won't mention how to install SSL certificate, in my another blog, you can find how to install it by how to install SSL certificate on Android phone or how to install SSL certificate on IOS device for iPhone.
The simple process includes:
1. Collect VPN account info, IP, username, password, VPN type, etc.
2. Set up a new VPN network.
On Mac, go to "System Preference" > "Network" to create a new type network. Select "VPN" for the interface, and put in the given VPN account info which collected in step 1. Then you will have a new VPN network connection created. Test it with connection and disconnection.
3. Set up a wifi network which is shared from VPN network that just set up in step 2.
On Mac, go to "System Preference" > "Sharing", select VPN network set up in step 2 from "Share connection from", give the wifi name and password, then you will see wifi is turned on from Mac Menu bar.
4. Set up connection from Phone. To make sure phone is connected to the wifi just set up in step 3.
5. Make sure VPN is on, wifi is on and phone connects to wifi, then you will see the traffic via the Charles. Also make sure SSL certificate is installed as well on phone in order to check traffic over HTTPS.
Hope above info helps you to solve the issue if app works or not via VPN in different country.