Discussion

1298
Views
Lukasz Gajewski Member since 2015 2 posts
PEGA
Posted: November 9, 2018
Last activity: October 15, 2020

Configuring Charles as a web proxy for mobile devices

Having access to network logs from your mobile device is critical to find out what exactly is happening inside mobile application. It enables you to make debugging quick and reliable, which saves valuable time.

In this article you can find helpful information about configuring your mobile device to cooperate with a web proxy. Please note that it may be problematic to setup Charles with VPN, so it is recommended to disable it before start.

What is Charles?

Charles is a powerful tool that enables you to record and display all the data that is sent and received via network by your mobile device. What's more, you can also enable it to act as a local web proxy to track all the inbound / outbound traffic from your web browser or any other application.

Charles - Key Features

  • SSL Proxying - view HTTPS requests and responses
  • Bandwidth Throttling - simulate slower Internet connection
  • Header & Body Viewers - tool includes several viewers that are enhancing the display for headers and body. Supports: query parameters, form parameters, cookies, authentication header, XML & JSON body, form data, multipart data and compressed data
  • Repeat and Compose - allows to repeat and edit requests for testing
  • Breakpoints - intercept and edit requests and responses
  • Rewrite - create rules that automatically modify requests and responses

How to configure Charles on your computer?

  1. Download & Install Charles (free trial)
  2. Open Charles
    • Go to "Help > Local IP Addresses", find and save your IP address (it must be accessible from mobile device)
    • Go to "Proxy > Proxy Settings" and make sure that HTTP Proxy port is set to 8888. Note: If you don't want to record your requests from local computer, then go to "macOS" tab and disable "Enable macOS proxy".
    • If you want to record SSLtraffic, then proceed to "Proxy > SSL Proxying Settings"
      • Check "Enable SSL Proxying"
      • Add new location that is suitable for you. Wildcards may be used here. To record all the traffic you should set:
        • Host: *
        • Port: *

How to configure Android device?

Firstly, you have to make sure that IP address of your computer is accessible for the device. To ensure that, both devices should be in the same Wi-Fi network.

  1. Go to your device's settings and Wi-Fi configuration.
  2. Press & hold on the network you're going to use.
  3. Select "Modify network".
  4. Scroll down and expand "Advanced options".
  5. Open "Proxy" settings and select "Manual" option.
  6. Set hostname and port that points to Charles web proxy:
    • Proxy hostname: [IP Address of your computer, previously saved]
    • Proxy port: 8888
  7. Click "Save".

After that, you should notice a pop-up on your computer. You should click "Allow" to proceed.

In order to view SSL requests from Android device you have to install Charles certificates. Below is a short and simple instruction how to do it. You can find more detailed one in Charles: "Help > SSL Proxying > Install Charles Root Certificate on a Mobile Device or Remote Browser".

  1. Launch the browser and open url chls.pro/ssl.
  2. The browser should download the certificate.
  3. Find the certificate on your device and install it. In case it cannot be installed by opening the file directly, go to "Settings > Security > Encryption & Credentials > Install a certificate" and proceed with installation.
    • Certificate name: Charles
    • Credential use: VPN and apps

All set up! Now, you are ready to track all network traffic inside your Android device.

Note: As of Android N, there is a need to add network security configuration in native application in order to trust the SSL certificates generated by Charles SSL Proxying. That configuration has been added to Hybrid Client 7.41. For older HC versions you have to use older Android device, if you want to record HTTPS requests.

How to configure iOS device?

Firstly, you have to make sure that IP address of your computer is accessible for the device. To ensure that, both devices should be in the same Wi-Fi network.

  1. Go to your device's settings and Wi-Fi configuration.
  2. Open "Info" icon next to your network.
  3. Select "Configure Proxy" and set to "Manual".
  4. Set server and port that points to Charles web proxy:
    • Server: [IP Address of your computer, previously saved]
    • Port: 8888
  5. Click "Save".

After that, you should notice a pop-up on your computer. You should click "Allow" to proceed.

In order to view SSL requests from iOS device you have to install Charles certificates. Below is a short and simple instruction how to do it. You can find more detailed one in Charles: "Help > SSL Proxying > Install Charles Root Certificate on a Mobile Device or Remote Browser".

  1. Launch the browser and open url chls.pro/ssl. Click "Allow" to open configuration profile.
  2. "Install Profile" screen should be shown. Click "Install" to proceed.
  3. A warning appears that contains further information about installing this certificate. Click "Install" to proceed.
  4. Verify that certificate is installed.

  1. Enable Certificate by going to "Settings > General > About > Certificate Trust Settings".

All set up! Now, you are ready to track all network traffic inside your iOS device.

Pega Mobile Client 8 Mobile Developer Knowledge Share
Share this page LinkedIn