background

Some modules of the current system are third-party websites based on wechat. When problems occur in the development and testing process of wechat page, it is difficult to locate and rectify problems because the request information can not be viewed through the console like the browser. To solve the problem of difficult debugging on mobile, we used Fiddler4, a tool to capture request information on mobile devices. Here is a brief introduction to using Fiddler4 to grab mobile Https requests.

Fiddler is introduced

  • Fiddler is a powerful packet capture tool that works in the form of a Web proxy server intercepting requests.
  • Proxy is to set up a checkpoint between the client and the server, the client will first request data sent out, the proxy server will intercept data packets, proxy server impersonates the client to send data to the server; Similarly, the server will respond with data, and the proxy server will intercept the data and send it back to the client.
  • Fiddler can grab packets from any program that supports Http proxies. To grab Https sessions, you need to install a certificate.
  • Download address

configuration

Open the software after installation, the left side of the interface is the request list captured

The HTTP details of a single request are displayed on the right side of the page. The upper part is the request and the lower part is the response

Packet capture and Https configuration on the mobile terminal

  • Tools > Options > Https. Select area A as shown in the following figure

  • Select blue for area B; ssl3; TLS

  • In the pop-up box, will prompt in; ssl2; ssl3; TLS. Tls1.1; Tls1.2 copy and paste it into the dialog box and click Ok, as shown in the following figure. (This step is used to configure the Https parsing protocol. Different mobile phones require different Https parsing protocols.

Click the Actions TAB in area C and click ‘Trust Root Certificate’ to install the certificate on the machine.

  • The Connections label is configured as shown in the following figure

  • In Https, Resposebody will need to be parsed, as shown below by clicking on the red box.

Mobile phone set

  • Check the local IP. For example, the local IP is 10.136.16.43. Set the Http proxy to manual for Wifi, set the server to the IP of the computer, and set the port to 8888, as shown in the picture below:

  • Open a browser and enter IP address :8888. For example, 10.136.16.43:8888 is entered on the local computer

Click on FiddlerRoot Certificate at the bottom and install the Certificate as prompted. Then go to Settings -> About this machine -> Certificate Trust Settings – and check DO_NOT_TRUST_FiddlerRoot (mandatory). After installing the Certificate, the request can be captured on the mobile terminal.

MIUI mobile phone installation certificate

  • Go to System Settings -> More apps
  • Find file (perfect match) -> Start
  • MIUI System Settings -> More Settings
  • System Security -> Encryption and credentials
  • From storage device Installation (Certificate) -> Select pem file
  • Fill in the certificate name (Charles) -> Credential purpose select “VPN and Applications” (WLAN is not possible)

Existing problems

  • After each configuration update of Fiddler, the software needs to be shut down and restarted in case the configuration is not applied.
  • The phone may encounter “Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm, This problem occurs because the Https protocol set by Fiddle4 is not compatible with mobile phones. If this problem occurs, fill in the Https protocol one by one. Do not copy all the Https protocols at a time, because priority may exist during parsing. Find an Https protocol that your mobile phone can identify and resolve by retry.