View Http Traffic of Mac or iPhone/iPad in Simulator Using Fiddler in Windows


I really love Fiddler! It has helped me a lot for a number of projects which in one way or another uses http request/response mechanism in its communication. Why would you want to monitor the http traffic of your iPhone application? One reason is when your iPhone application needs to use the same web services being used by an existing non-iPhone application. You may know the request parameters based on the documentation of the web services but you don’t know how the parameters are actually formed in the request. Please note that this post describes a scenario where a Mac, of course, is used for developing an iPhone application and a Windows machine hosts the Fiddler application. Pure Mac developers may know of a tool different from Fiddler to monitor http traffic.

Setup Fiddler to Serve as a Proxy Server

In Fiddler, click Tools | Fiddler Options menu item to launch the Fiddler Options dialog box. Select the Connections tab of the Fiddler Options dialog box and make sure that the Allow remote computers to connect checkbox is checked. Take note of the port number in the field labeled Fiddler listens on port:. This will be the port number that you will use when setting up the proxy server in your Mac.

image

 

Take note also of the IP address of this machine since you will have to enter this address in Mac Network Preferences. You can run IPConfig from the Windows console to get the IP Address or you can open network preferences for the same purpose.

 

Setup Mac OS to Use a Proxy Server

Open Network Preferences. You can launch it by either clicking on the Network icon in System Preferences or by clicking the Wi-Fi/AirPort icon (if you are using the AirPort) in top right-most portion of your screen and the Open Network Preferences menu item.

Screen shot 2010-08-18 at 12.42.20 PM

 

image

In the Network Preferences dialog box, click the Advanced button.

image

 

Under the Proxies tab, check Web Proxy (HTTP). Enter the IP address of the machine hosting the Fiddler proxy host in the Web Proxy Server field and the port number (8888 in this example) configured in Fiddler.

image

Click Ok and close Network Preferences.

In Fiddler, make sure File | Capture Traffic menu item is checked.

image

Open a browser window from Mac and watch as Http traffic from your Mac shows up in Fiddler. Run your iPhone application from the simulator and you can also see the Http traffic as your iPhone application makes request to a web service.

This work is licensed under a Creative Commons Attribution By license.
About these ads
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

5 Responses to View Http Traffic of Mac or iPhone/iPad in Simulator Using Fiddler in Windows

  1. Gilad says:

    Thanks for this tip, made debugging safari a breeze.

  2. Action says:

    Great thanks! Got it working via Parallels :)

  3. Chris Walker says:

    Well done with the screen shots and clear concise steps!

  4. Brad Lowe says:

    You can also view content directly from an iPhone without using the Mac and simulator:
    In fiddler, under connections, enable “Allow remote computers to connect” (restart req)
    On your iPhone, go to your wireless settings, click on the right arrow to get more details.
    Add a manual proxy, using the IP of your Windows machine running fiddler, and add the port.
    That’s it!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s