Craft At WillowTree Logo
Content for craftspeople. By the craftspeople at WillowTree.
Engineering

12 Steps For Setting Up Charles Proxy With tvOS

This might not be the first time you’ve read about Charles Proxy here on the WillowTree blog. Maybe you’ve even watched this awesome video about Charles Proxy my co-workers made& as part of the WillowTalk series. But just in case you’re unfamiliar with Charles, it’s a tool that allows us to setup a workstation as a proxy between an app we’re developing and the internet. It also allows us to inspect API requests and spoof the responses.

The QA team at WillowTree uses Charles Proxy frequently to do things like validate network calls, verify analytics, modify responses to do negative testings, etc. Setting up Charles on devices is usually a pretty straightforward process. But as we recently discovered, it’s a different story when you’re working with tvOS apps.

There is no apparent way to add proxy settings, and in order to encrypt communications using SSL (Secure Sockets Layer) with Charles Proxy, you have to install the Charles SSL certificate from www.charlesproxy.com/getssl on the device you’re checking. But this is impossible on an Apple TV because there is no browser and no way to install certificates locally.

After some research, we found out Apple Configurator (a tool for quickly setting up many devices with predefined settings like wifi networks and content filters) can be used to solve both of these issues. * What follows, is how we set up Charles Proxy to work with tvOS using Apple Configurator.

Set up a profile

In order to set up tvOS, you need to use a profile to setup a proxy.

  1. Download and install Apple Configurator.
  2. Open Apple Configurator and navigate to File -> New Profile.
  3. Give your profile a name and a unique identifier. Typically you’ll be setting it up to go through the same PC you’re using, so indicating this is encouraged (e.g. Charles-JoeLaptop).
  4. Select Global HTTP Proxy* on the left and click configure.
  5. Input your IP address of the machine running Charles and 8888 (default) for the port. *
  6. If you need SSL, you need to add the Charles SSL cert. (if you’re not tracking SSL you can ignore this part):
  • Go to charlesproxy.com/getssl to get the SSL cert.
  • When you download this it will be a *.pem file containing the certificate you need. You need the certificate in a different format to add to your profile. (There are different ways you can do this, I found the simplest way was to add it to my keychain then export it as a *.cer file.)
  • Back in Configurator, select Certificates on the left and click Configure.
  • This brings up a dialog to select the relevant certificate, select the one described above and click Open.
  • It may say, “This root certificate is not trusted.” This just reflects the status of the user you’re using on the Mac.
  • Save and close the Profile.

Install the profile

  1. Now you will need to load the Profile onto the Apple TV. This requires a USB-C adapter.
  2. With the Apple TV turned on, connect it to your Macbook using the USB-C adapter.
  3. Open up Apple Configurator.
  4. The Apple TV should show up under All Devices.
  5. Select the device and click on the Add button at the top of the window.
  6. Select Profiles and find the profile you created above, then click Add Profiles. Congratulations, now you should be able to see http and https traffic from the Apple TV.

*Note: You can also use wifi settings and setup the proxy for only one network. You will need to select Wi-Fi from the left and input your network settings along with a manual proxy using the same settings. This means the proxy won’t be used if you use a different Wi-Fi network.)

*Note: Large organizations often use Apple Configurator to set up security settings and other restrictions more easily. It should be noted that Apple Configurator is not something we use often at WillowTree, as we try to emulate real-world use cases to get the most coverage possible. For us, that means configuring each device differently.

Table of Contents
Matthew Wolfe

Read the Video Transcript

Recent Articles