Expand my Community achievements bar.

Mboxtrace from iPhone Web or App using Charles on Macbook

Avatar

Employee Advisor

6/1/23

==============
On your Macbook:

==============
Basic Setup:
01. Install Charles: https://www.charlesproxy.com/download/
02. Ensure your Macbook and iPhone are connected to the same WiFi network.
03. Get your WiFi IP address on your Macbook by doing the following:
03.1 Open finder. (Command + Spacebar)
03.2 Search for wifi
03.3 Click "Details" for the WiFi network you are connected to.
03.4 In this pop-up, you will see the "IP address" 172.24.41.104 (Write this down somewhere as we will need it later.)

Charles SSL Proxy Settings: 
04. In Charles, go to: "Proxy" > "SSL Proxying Settings..."
05. Make sure that "Enable SSL Proxying" is checked. 
06. On the Include side, click "Add."
07. In the "Host:" field, add *
08. Click "Ok" > "Ok."


Additional steps only for Mobile Apps (Skip steps 09-16.3 if you are testing browsing to the website from iPhone)
09. In Charles, go to: "Tools" > "Rewrite."
10. Make sure to check "Enable Rewrite."
11. Click "Add" for the section on the left.
12. Name it "Mboxtrace for Target requests."

13. Click "Add" for the section on the top and add a location with the following settings:
Protocol: https
Host: *.tt.omtrdc.net
Port: *

14. Click "Add" for the section on the bottom and configure the following in the pop-up:
Type: Add Header
Select "Request"
Replace Name: authorization
Replace Value: ALPHANUMERICONLYMBOXTRACETOKENHERE
Select "Replace All"
Click "OK" > "OK"


If Mobile App is running on V1 Server Side Delivery (Mbox: https://<your-client-code>.tt.omtrdc.net/rest/v1/mbox/)
15.1. Click "Add" for the section on the left.
15.2. Name it "Mobile App V1 Server Side"
15.3. Click "Add" for the section on the bottom and configure the following in the pop-up:
Type: Body
Select "Request"
Match Value: ("mbox"\s*:\s*.*,)
New Value: $1"mboxTrace":"True",
Select "Replace first."


If Mobile App is running on V2 Server Side Delivery (Mbox: https://<your-client-code>.tt.omtrdc.net/rest/v2/batchmbox)
16.1. Click "Add" for the section on the left.
16.2. Name it "Mobile App V2 Server Side"
16.3. Click "Add" for the section on the bottom and configure the following in the pop-up:
Type: Body
Select "Request"
Match Value: ("client"\s*:\s*.*,)
New Value: $1"trace":{"enabled":true,"includeMetrics":true},
Select "Replace first."

Charles Display Settings:
18. Note: After successfully connecting to the proxy from your iPhone, there will be a pop-up where you will have to "Allow" the connection.
16. In Charles, switch from "Structure" to "Sequence"
17. Under "Filter," enter .tt. to only show the relevant call.
19. After you browse to the URL in question from the iPhone, you will see a result in the network log (top window)
20. Click on the network call to select it.
21. In the middle window, switch it to "Contents."
22. In the bottom window, switch it to "JSON Text" (Note: this text is your mboxtrace)


============
On your iPhone:
============
Configuring a Trusted certificate for secure traffic: 
01. In Safari, browse to chls.pro/ssl 
02. Download the security certificate. 
03. Instal the security certificate from: "Settings" > "General" > "VPN & Device Management" > "Downloaded Profile" > "Charles Proxy CA..." > "Install" > "Install."
04. Configure the Certificate to be trusted from: General > About > Certificate Trust Settings, find the Charles Proxy certificate, and switch it on


Configuring WiFi & Charles Proxy Connection: 
05. Open the Control Center (Swipe down from the top right of the screen) and go into Airplane Mode.
06. From the same screen, enable Wifi antenna.
07. Connect to the same wifi network that your Macbook is on.
08. Open your Wifi settings on your iPhone.
09. Click the little "i" (Info icon) for the wifi network you are connected to.
10. Disable "Private Wi-Fi Address"
11. Disable "Limit IP Address tracking."
12. Scroll to the bottom and go to: "Configure Proxy" > "Manual."
13. For the server, use the IP previously copied.
14. For port use: 8888
15. Click "Save."
16. Congrats you are routing all your iPhone traffic through Charles.


Running mboxtrace for URL or Mobile App:
17. In Safari on the iPhone, browse to the URL in question with mboxtrace appended to the end of the URL as a URL parameter like this: https://www.YOURURLGOESHERE.com?mboxTrace=window&authorization=4461f76f-de41-47fe-baf8-9e6fd29db236
18. If testing a mobile app, now would be the time to open and run the mobile app.