# iPhone and iPad

> Capture and decrypt HTTPS traffic from a real iPhone or iPad by setting its Wi-Fi proxy to your Mac and trusting the Cloak Proxy certificate.

Source: https://docs.subcloak.com/cloak-proxy/devices/iphone-and-ipad/

To debug an app on a real iPhone or iPad, point the device's Wi-Fi proxy at your Mac and install the Cloak Proxy certificate on it. The device and the Mac must be on the same Wi-Fi network. The **iPhone & iPad** page of **Device & Runtime Setup** shows your Mac's address, the port and a QR code for the certificate.

Capturing the iPhone or iPad's own apps without a Mac? In version 1.1 of the iPhone and iPad app, the Cloak Proxy app can do it on the device, in the background too, with [VPN capture](https://docs.subcloak.com/cloak-proxy/ipad/vpn-capture/). See [Cloak Proxy for iPhone and iPad](https://docs.subcloak.com/cloak-proxy/ipad/overview/).

*[Screenshot: The iPhone & iPad page of Device & Runtime Setup showing a warning that other devices can't connect yet, an Allow Other Devices to Connect button, the server 192.168.1.20 and port 9090, a QR code for the certificate, and an If nothing arrives section with what to check on the device and an Open the Doctor button. The iPhone & iPad page. The warning and button appear only while other devices can't connect.]*

## Before you start

- Your Mac and the iPhone or iPad are on the same Wi-Fi network, and the network lets devices reach each other. Guest networks and some office networks block this.
- Cloak Proxy is running. It doesn't need the macOS proxy on to capture a device.
- You know which hosts you want to decrypt. Add them in [SSL Proxying](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/), or HTTPS from the device passes through encrypted.

## Let the device connect

By default Cloak Proxy only accepts connections from your Mac. When that's the case, the **iPhone & iPad** page shows **Other devices can't connect yet.**

1. Open **Device & Runtime Setup** (click **Devices** in the toolbar) and choose **iPhone & iPad** in its sidebar.

2. Click **Allow Other Devices to Connect**.

   Cloak Proxy turns on **Allow other devices to connect (phones, other computers)** and restarts the proxy right away. If the macOS proxy was on, it's turned off and back on during the restart. The warning disappears.

You can also turn this on in **Settings › General**. To accept only your iPhone, add its address to **Allowed devices** in **Settings › Network**. See [Other devices and access control](https://docs.subcloak.com/cloak-proxy/devices/other-devices-and-access-control/).

> **Anyone on your network can use the proxy:**
> While other devices may connect, any device on your network can send traffic through Cloak Proxy unless you set up **Allowed devices**. Turn it off when you finish debugging.

## Set the Wi-Fi proxy on the iPhone

The tab's first section, **1. Set the Wi-Fi proxy on the iPhone**, shows the values to enter. **Server** is your Mac's IP address on the local network (for example `192.168.1.20`) and **Port** is the port Cloak Proxy listens on (`9090` by default). Both are selectable so you can copy them.

1. On the iPhone or iPad, open **Settings › Wi-Fi**.

2. Tap the **ⓘ** button next to the network you're connected to.

3. Scroll down and tap **Configure Proxy**.

4. Choose **Manual**.

5. Enter the **Server** and **Port** shown in Cloak Proxy. Leave **Authentication** off.

6. Tap **Save**.

Open any website on the device. Its requests appear in Cloak Proxy's traffic list, and the sidebar lists the device under **Devices**, with the apps it used under it. See [See traffic by device and app](#see-traffic-by-device-and-app).

> **Note:**
> Cloak Proxy shows the address of your Mac's primary network interface (`en0`, usually Wi-Fi). If your Mac gets a new address, for example after reconnecting to the network, update the **Server** on the device.

## Install the certificate

The tab's second section, **2. Install the certificate**, gives you two ways to open the certificate page.

**Scan the QR code**

Point the iPhone's Camera app at the QR code in Cloak Proxy and tap the link that appears. The QR code opens `http://` followed by your Mac's address and port (for example `http://192.168.1.20:9090/`), so it works even before you set the Wi-Fi proxy, as long as other devices may connect.

**Open http://cloak.proxy**

After you set the Wi-Fi proxy, open Safari and go to `http://cloak.proxy`. Cloak Proxy answers this address itself, so it only works while the device's proxy points at Cloak Proxy.

Both show the same page, titled **Cloak Proxy**. Its first button, **Install on iPhone or iPad** (added in Cloak Proxy 0.2.3), downloads the certificate as a configuration profile, which Safari offers to install. (The **Download certificate** buttons below it are for other systems; on an iPhone or iPad, Safari may only save those to Files.) Then:

1. Tap **Install on iPhone or iPad**.

   Safari asks whether to allow the configuration profile to download. Tap **Allow**, then **Close**.

2. Open **Settings › Profile Downloaded**, near the top of **Settings**. You can also find it in **Settings › General › VPN & Device Management**.

3. Tap the profile. It's named **Cloak Proxy CA** followed by your Mac's name in parentheses, for example **Cloak Proxy CA (MacBook Pro)**.

4. Tap **Install**, enter the device passcode, and confirm with **Install** again.

5. Open **Settings › General › About › Certificate Trust Settings**.

6. Under **Enable full trust for root certificates**, turn on the switch for **Cloak Proxy CA**, then tap **Continue**.

Without the last step, iOS installs the profile but apps still reject the certificates Cloak Proxy creates, and HTTPS requests to hosts in SSL Proxying fail.

> **The Cloak Proxy app on iPhone and iPad has its own certificate:**
> If you also use the Cloak Proxy app to capture on the iPhone or iPad itself, that app makes a different certificate. Each one needs its own full trust. This page is about your Mac's.

> **Install it only on devices you own:**
> The certificate lets Cloak Proxy decrypt HTTPS traffic from the device for the hosts you choose. Install it only on your own devices, or on test devices you have permission to debug, and remove it when you're done. The certificate page says the same.

## Check that it works

1. Add a host your app uses to [SSL Proxying](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/), for example `api.example.com`.

2. Open your app on the device and use the feature you're debugging.

3. In Cloak Proxy, select your app under the device in the sidebar's **Devices** group. Requests to `api.example.com` show their full headers and bodies.

If an app's requests fail only while the proxy is on, the app may pin its certificates. Pinned apps reject any certificate except their own, and Cloak Proxy can't decrypt them. Remove the host from SSL Proxying to let that app's traffic pass through encrypted. See [SSL Proxying](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/).

## See traffic by device and app

(added in Cloak Proxy 0.2.3)

Cloak Proxy names each request from a device by the app that sent it, read from the request's `User-Agent` header, since a Wi‑Fi proxy can't see which app opened a connection.

| `User-Agent` | Shown as |
|---|---|
| `Weather/2.1 CFNetwork/1490 Darwin/23.2.0` (most iPhone and iPad apps) | **Weather** |
| Safari, Chrome, Firefox, Edge and other browsers | The browser's name |
| An app's web view | **Web view** |
| `Dart/3.1 (dart:io)` (Flutter apps) | **Dart app** |
| `okhttp/4.12.0` | **OkHttp app** |
| No `User-Agent`, or one that names no app | The device itself |

Encrypted HTTPS that isn't decrypted usually carries no `User-Agent`, so those tunnels stay under the device. iOS often sends one when it opens a tunnel, and then the tunnel is named by its app too. Once a host is decrypted, each request inside it is named by its own `User-Agent`.

The sidebar lists every device under **Devices**, with its request count, and the apps it used under it. Click the device for everything it sent, or an app for that app on that device only. The traffic list's **Client** column reads, for example, **iPad · Weather**.

A device is named by its kind and address, for example **iPad · 192.168.1.30**. The kind comes from any `User-Agent` that says it, such as Safari's `(iPad; CPU OS 17_0 …)`, and is remembered for the address; until then the device shows as **Device**. To give a device your own name, right-click it in the sidebar and choose **Rename…**. Names are kept per IP address.

Rules limited to apps, muting, SSL Proxying by app and Privacy Map work with these names. An app's name covers that app on every device and on your Mac, and a device's address, for example `192.168.1.30`, covers everything from that device. See [Sidebar › Devices](https://docs.subcloak.com/cloak-proxy/inspect/sidebar/#devices).

## Decrypt everything from a device

(added in Cloak Proxy 0.2.3)

Select an encrypted tunnel from the device. Below **Enable only _host_**, the inspector offers **Decrypt all of this device's HTTPS…** (or **Decrypt all HTTPS from _app_…** for a tunnel its app was named for), and says **To decrypt, this device needs Cloak Proxy's certificate.**, with **Set up iPhone & iPad…** to open this setup at the certificate step.

**Decrypt all of this device's HTTPS…** asks first. Choose **Set Up the Certificate…** if the device doesn't trust it yet, or **Decrypt Anyway**.

> **A device that doesn't trust the certificate loses its HTTPS:**
> When Cloak Proxy decrypts for a device that hasn't installed and fully trusted the certificate, apps and websites on it can't connect. If a device refuses the certificate three times within two minutes, Cloak Proxy stops decrypting for it, removes **Decrypt all of this device's HTTPS**, and shows a banner: _device_ **doesn't trust Cloak Proxy's certificate, so decryption was turned off.**, with **Set Up the Certificate…**. Its HTTPS then passes through encrypted again. Once the device completes a decrypted connection, for example after you set up the certificate and choose **Enable only _host_** or **Decrypt Anyway** again, it's trusted and decrypted as usual.
>
> Even when the whole device is decrypted, a few Apple system services always pass through encrypted, because they accept only Apple's certificates: app verification for apps installed from Xcode, push notifications, Apple Account sign-in and activation. See [What's never decrypted](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/#whats-never-decrypted). (added in Cloak Proxy 0.4.0)

## Undo the setup

Remove the proxy and the profile when you're done. The tab reminds you: **Remove the profile and the Wi-Fi proxy when you're done.**

1. On the device, open **Settings › Wi-Fi**, tap **ⓘ** next to the network, tap **Configure Proxy**, choose **Off**, and tap **Save**.

   Do this before you quit Cloak Proxy or leave the network. While the proxy points at a Mac where Cloak Proxy isn't running, the device can't reach the internet over that Wi-Fi network.

2. Open **Settings › General › VPN & Device Management**, tap the **Cloak Proxy CA** profile, tap **Remove Profile**, and enter the passcode. This also removes it from **Certificate Trust Settings**.

3. On the Mac, open **Settings › General**, turn off **Allow other devices to connect (phones, other computers)**, and click **Apply & Restart Proxy**.

> **Tip:**
> If you regenerate the root certificate in **Settings › Certificate**, devices that trusted the old one need the new one installed. Remove the old profile and install the certificate again from `http://cloak.proxy`.

## If nothing arrives

(added in Cloak Proxy 0.5.1)

The **iPhone & iPad** page ends with **If nothing arrives**. While the page is open, the [Doctor](https://docs.subcloak.com/cloak-proxy/capture/doctor/) checks this Mac and lists what stops the device reaching Cloak Proxy: **Allow other devices to connect** off, the [macOS firewall](https://docs.subcloak.com/cloak-proxy/capture/doctor/#firewall) blocking incoming connections, or [Internet Sharing](https://docs.subcloak.com/cloak-proxy/capture/doctor/#internet-sharing) on. **Open the Doctor** shows everything it checked.

*[Screenshot: The iPhone & iPad page of Device & Runtime Setup ending with 3. If nothing arrives: a red problem The macOS firewall blocks all incoming connections, a warning Internet Sharing is on, a list of settings to check on the iPhone or iPad, and an Open the Doctor button. What the Doctor found on this Mac, and what to check on the device.]*

On the iPhone or iPad:

- **Turn off VPN apps.** A VPN carries the device's traffic and skips the Wi-Fi proxy.
- **Turn off iCloud Private Relay** (**Settings › your name › iCloud › Private Relay**), and **Limit IP Address Tracking** for this network (**Settings › Wi-Fi › ⓘ**). Both can send Safari's and some apps' traffic over their own relay.
- **Use the same Wi-Fi network as the Mac**, not mobile data or a guest network.

## Troubleshooting

| Symptom | What to check |
|---|---|
| The device can't load any page | Cloak Proxy is running, **Allow other devices to connect** is on, the **Server** and **Port** match the tab, and the device's address is in **Allowed devices** (if you use the list). |
| The QR code or `http://cloak.proxy` doesn't open | The QR code needs other devices to be allowed. `http://cloak.proxy` also needs the Wi-Fi proxy set. |
| HTTPS requests show as tunnels | The host isn't in [SSL Proxying](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/). |
| HTTPS requests fail with a certificate error | Full trust isn't turned on in **Certificate Trust Settings**, or the app pins its certificates. |
| A banner says the device doesn't trust Cloak Proxy's certificate | Install the profile and turn on full trust, then decrypt again. See [Decrypt everything from a device](#decrypt-everything-from-a-device). |
| Safari saves the certificate to Files instead of installing it | Use **Install on iPhone or iPad** at the top of the certificate page. |
| Nothing appears for one app | The app may not use the system proxy. See [Apps that ignore the proxy](https://docs.subcloak.com/cloak-proxy/capture/apps-that-ignore-the-proxy/). |
| Nothing arrives although the Wi-Fi proxy is set (added in Cloak Proxy 0.5.1) | See [If nothing arrives](#if-nothing-arrives): the Mac's firewall, Internet Sharing, a VPN or Private Relay on the device. |
| The device is plugged into the Mac by USB | With Internet Sharing on, it may use the Mac's connection instead of the Wi-Fi proxy. Turn off Internet Sharing or unplug it. |

For more, see [Troubleshooting](https://docs.subcloak.com/cloak-proxy/reference/troubleshooting/).

## Related

  - [Other devices and access control](https://docs.subcloak.com/cloak-proxy/devices/other-devices-and-access-control/): Restrict which devices can connect, and the certificate page.
  - [SSL Proxying](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/): Choose which hosts are decrypted.
  - [iOS Simulator](https://docs.subcloak.com/cloak-proxy/devices/ios-simulator/): Capture simulators without a Wi-Fi proxy.
  - [Debug a mobile app](https://docs.subcloak.com/cloak-proxy/guides/debug-a-mobile-app/): A full walkthrough on a real device.
  - [Cloak Proxy for iPhone and iPad](https://docs.subcloak.com/cloak-proxy/ipad/overview/): Capture on the device itself, with VPN capture or the Wi-Fi proxy, and connect AI assistants over HTTPS.
