Debug HTTPs requests in iOS Simulator

Getting Started
Installation
Setup
Inspect Traffic
HTTP Rules (Modify Traffic)
Session Book
Mock Server
API Client
File Server
Workspace
Public API
Guides
TroubleShooting
Subscription & Billing
Getting Started
Installation
Setup
Inspect Traffic
API Client
HTTP Rules (Modify Traffic)
Mock Server
File Server
Workspace
Public API
Guides
Session Book
Subscription & Billing
TroubleShooting
 

Debug HTTPs requests in iOS Simulator

To start debugging the network traffic of your apps running inside iOS simulator, follow these steps
  1. Download & install Requestly Desktop app
  1. To install Requestly Root Certificate on your Mac:
    1. a. Navigate to Connected Apps in the sidebar and choose target Everywhere: System Wide
      b. Enter system password if prompted
      c. Ensure that the Install & Trust Certs step is successful
notion image
  1. Note the proxy URL and port shown at the top of the App. This is where requestly is running it's proxy and where you need to redirect your traffic to from iOS emulator
notion image
  1. Open XCode and choose your project. In the menu click Product > Scheme > Edit Scheme
notion image
  1. Set enivronment variables  http_proxy  and  https_proxy  to the proxy URL given by Requestly (refer step #3)
notion image
  1. Start the emulator Xcode > Open Developer Tool > Simulator
notion image
  1. To verify the proxy settings: Open Safari and navigate to http://amiusing.requestly.io/ If it says Success, all good till now. Else retry from step #2
notion image
  1. Now you need to install Requestly's Root Certificate in the emulator
    1. In Safari, navigate to http://requestly.io/ssl (Use http here, not https) and tap Allow to download the Requestly Root Certificate
      1. notion image
    2. After downloading the certificate, navigate to General in Settings and choose Device Management
      1. notion image
    3. Open RQProxyCA and click Install
      1. notion image
 
  1. Since this certificate has been installed, we need to mark it as trusted. Navigate to Settings > About > Certificate Trust Settings and enable trust for RQProxy CA
notion image
  1. Once the certificate has been trusted, you can now intercept traffic using Requestly and create rules to modify them as required
notion image
You should now be able to see your rules being applied in the traffic table inside Requestly.
But here are a few more tips to fully utilize requestly with the debugging tools that iOS simulator offers
 

Open native Web Inspector or Developer Tool for Safari

In case you want to also see the requests in the safari devtools of your simulator:
  1. Launch Safari in iOS Simulator:
  1. Launch Safari on your mac and navigate to Develop in the menu bar,
  1. Find your Simulator device and tap the webpage you want to inspect.
 
notion image
notion image

Bypass CORS for Safari running in simulator

You might sometimes run into CORS issues when trying to apply rules during debugging.
To disable CORS for safari inside the iOS simulator:
  1. Navigate to the Develop menu in Safari and
  1. Check Disable Cross-Origin Restrictions and Local FIle Restrictions
notion image