Problem
Your mobile device is having issues connecting to Mattermost and you want to download the traffic as a HAR file for analysis
Solution
1. Install mitmproxy
on your workstation
Mitmproxy Installation Instructions
2. Create the har_dump.py
script to export it as a HAR file
Download the har_dump.py
script and place it in your current directory.
3. Run mitmdump
to export the traffic as a HAR file
mitmdump -s ./har_dump.py —set hardump=./dump.har
4. Configure device to use your workstation as a proxy
Make sure your device and workstation are on the same network, and get the IP address of your workstation.
Android
Under Settings
> Network & Internet
> Wifi
, click the gear next to the network you’re using and then click the Pencil icon to edit it. Under Advanced Options
find the Proxy settings and select Manual
then enter the following configuration:
- Proxy hostname - IP address of your workstation
- Proxy port - 8080
iOS
Go to Settings
> Wifi
and click the i
button next to the connected network. Then click Configure Proxy
at the bottom and set it to Manual
, then enter the following values:
- Server - IP address of your workstation
- Port - 8080
5. Install the mitmproxy
certificates on the device
Because mitmproxy
uses its own certificates, HTTPS connections won’t work until the certificates are installed. To install them, open the device’s web browser and go to http://mitm.it
, then tap the icon for the platform you are using. The device will ask to authenticate before installing.
NOTE: Be sure to remove the certificate from the device when you are done testing to prevent someone from intercepting your traffic
Discussion
Diagnosing issues on mobile devices is difficult because they lack the browser debugging tools of the Mattermost desktop app. By using mitmproxy
we can not only see the URL of the request, but also the data in the request.