While developing or debugging, having eyes on the data flowing in and out of a device is essential to answer questions like: Was that the expected image for this position? Is that crash from code or bad data? Are the analytics events being sent properly?
That’s why the lack of proxying for Fire TV devices is a major oversight by Amazon. Fortunately, there’s a workaround to proxy the Fire TV devices, although it still won’t allow local mapping of files. Assuming you are on a Mac and have Wireshark installed, these steps will work for 1.12 or 2.0 versions of Wireshark with one minor difference.
Here are the steps for the workaround: Go to System Preferences > Sharing and click Internet Sharing for the Wi-Fi port. Next, set a password and turn on security in your Wi-Fi settings. Connect your Fire TV device to your new Wi-Fi network.
At this point, you might think you can stop reading since it should be trivial to proxy your MacBook traffic, which now includes the Fire TV’s traffic. However, when Internet sharing from a Mac, the traffic goes through a different interface, specifically bridge100. Charles, my personal favorite proxying app, doesn’t capture the traffic from that interface.
This is where Wireshark comes into play and partially saves the day. When you start WireShark, you’ll need to navigate to the Interface List on the left side for version 1.12. If you are using 2.0, you’ll access the interface list under Capture. From there, scroll through that list to find bridge100. Choose it and click Start. For 2.0 users, simply double-click bridge100.
You can now see the network traffic for your Fire TV. Unfortunately, you can now see everything including a torrent of TCP requests and responses. For your own sanity, filter with ‘http’ by typing ‘http’ into the text box near the top of the screen. There are a lot of filter options including by the destination IP addresses and a specific regex for a specific uri, ‘ip.dest==10.1.1.1’ and ‘http.request.uri matches regex’, respectively. Click here for more details regarding filter options. Another unfortunate result of this fix is that you have to use Wireshark’s horrendous UI, although admittedly it is better in 2.0. Worst of all, it’s impossible to map files.
Examining the traffic is a little harder in Wireshark than Charles, so here are some basics. To see the request params, click on the frame you want to examine and expand the HTML Form URL Encoded line. To see the url, expand the Hypertext Transfer Protocol and look for the Full request URI. To view a response, right click on the frame and select Follow TCP stream. Finally, copy the response into something that won’t burn your eyes, such as JSON Pretty Print.
This same setup can also be used to proxy a Roku. Proxying really should be an option on these devices. However, it seems some device makers have neglected to make proxying a priority and have overlooked how necessary it is for development and debugging. Until they change their ways, use the steps above to proxy such devices.