Can't access Rails app using VMWare because of subdomains?

I have a Rails app running on my Mac, and I'm using VMWare Fusion with Windows XP installed.

My Rails app uses subdomains, and I usually access it on my mac using http://<subdomain>.lvh.me:3000

-or-

I also have a pow server, and can access my Rails app on my mac using: http://<subdomain>.<mydomainname>.dev


But I can't access the app in VMWare using subdomains. I can't use lvh.me:3000 or my pow domains.

Does anyone know how to make this work?

Answers


You should be running your virtual machine using the bridged network mode. This will put the machine on the same network as the host OS.

If that doesn't work, I would use your VM's hosts file to add manual entries for to your host machine.


To use subdomains with lvh.me in VMWare Fusion edit the Windows host file which, for the Windows 8 consumer preview, is located in

C:\WINDOWS\system32\drivers\etc\hosts

You might need to right click this file and in properties > security give yourself write permissions as otherwise, strangely in spite of being an administrator, you might be unable to save the file.

Open the host file within Notepad and map your IP address to the hostnames once per line:

192.168.8...      lvh.me
192.168.8...      promoter.lvh.me
192.168.8...      discover.lvh.me

Open the browser and access them as usual at

http://lvh.me:3000http://promoter.lvh.me:3000 http://discover.lvh.me:3000


If you have a DNS server on your network assigning the subdomain to your workstation IP address then you can configure the virtual machines Network Adapter to Connect Directly to the physical network. This worked for me though I only used my IP address instead of an actual name.

If you don't have a name server then you can edit the hosts file on the virtual machine, though this becomes troublesome if you use dynamic IPs (having to remember to edit it each time you restore from suspend, etc.).


Need Your Help

Data binding in container user control

wpf data-binding user-controls

I have user control that behaves as container: