Parallels: browser test your OS X localhost

As a developer, you’ll have to pry my Macbook out of my cold, dead fingers.  But most of the world lives and breathes Windows, so I test my web application on Microsoft Internet Explorer and Firefox for Windows.

The easiest way to do this is to run Parallels.  I’ve got Parallels virtual machines for XP, Vista and Windows 7.   I’ve got different virtual machines for XP with IE 6, 7 and 8 .  I even browser test on Ubuntu (god knows why).

But, how do all those Windows browsers access the web server running on your OSX localhost?  Localhost on the PC maps to its own localhost, not the host Mac.

Take your pick:

http://<yourcomputer>.local:  OS X creates a DNS entry on the local network named <yourcomputer>.local.   You find your computer’s name in Control Panel > Sharing.   I named my computer MoBook, so in Internet Explorer I type http://mobook.local/ to hit the webserver I have running on OS X at http://localhost:80/

http://yourgatewayIPaddress: Parallels creates a little DHCP network for your virtual machines, and the OS X machine itself is at the gateway IP.   Go into Parallels > Preferences > Advanced > Network and the gateway is most likely the Start Address with a 0, 1 or 2 in front of it.  For example, my Start Address is 10.211.55.1 and in Internet Explorer I type http://10.211.55.2 to hit the webserver I have running on OS X at http://localhost:80.

This is with Parallels 6.  These should also work in previous versions of Parallels, as well as VMWare Fusion.