How To Use Charles Proxy With HeadSpin

November 25, 2021
 by 
Sreenadh Balasundaram
No items found.

Charles is an HTTP proxy, also known as HTTP monitor or Reverse Proxy, that allows the tester to observe and modify all of the HTTP and TLS/HTTPS traffic between their machine and the Internet. This includes requests, responses, and HTTP headers.

HeadSpin is the world’s first Digital Experience AI Platform combining cloud-hosted and on-prem global device infrastructure, test automation, and machine learning (ML)-driven performance & quality of experience analytics for mobile, web, audio, and video. HeadSpin empowers engineering, QA, operations, and product teams to assure optimal digital experiences throughout the development lifecycle. The platform’s extensive on-premise and cloud-hosted global device infrastructure enables teams to proactively test and monitor mobile, web, audio and video applications in real-time.

To run Charles proxy with a device connected from the HeadSpin device cloud to your local machine the following steps can be performed.

Step 1:

For running `hs connect` on your device you will be required to download the `hs` command-line tool. CLI is a HeadSpin Desktop Integration that enables additional IDE and test support for developer machines and integration servers. Go to settings in HeadSpin device cloud by clicking on the three-dot menu(Ellipses) and scroll down to Downloads section.

If you already have HeadSpin CLI installed on your local machine you can skip to Step 4.

The link will redirect you to a new page in which you are required to create an API Token only if you haven't created one before. Download the suitable file for your operating system from the Downloads section of this page.

Step 2:

After downloading the file for Mac or Linux use

Open terminal→navigate to the folder containing HeadSpin CLI→run command 

sh install.sh’ 

Step 3:

To run Charles proxy using a remote device in the HeadSpin device cloud, first start the desired device in the HeadSpin Remote Control UI. Once the device is started, go to Tools.


Step 4:

Now that you have HeadSpin CLI installed in your system copy the link given for Remote Debug.

Step 5:

HS Connect bridges the device to the user's local development machine and makes it available to local development tools as if it was connected to the machine directly via USB.

HS connect the device by pasting this command in your terminal and press enter. The device will be available locally if the setup is done correctly.

Step 6:

Reverse the ports by setting 8181 as listener port instead of 8888 used by Charles Proxy. To reverse the ports use the command   ‘adb reverse tcp:8181 tcp:8888

Run this command in your terminal. (Running this command will not produce or return anything in the terminal window when you hit enter after typing this command the terminal will go to the next line.)


Step 7:

Go to the wifi setting of the remote device and click on advanced settings, now set the proxy to manual.

Set  Proxy hostname as - localhost

And proxy port as - 8181

Now save these settings.


Step 8:

Open Charles Proxy on your local machine. You will be able to monitor and modify all of the HTTP and TLS/HTTPS traffic between the device and the Internet.

Click to know more about Charles Proxy.