0

I already have a custom domain name entry on my Mac's /etc/hosts file that I use for local testing. I'm able to connect from a browser using http://dev.mysite.co:5000.

127.0.0.1 dev.mysite.co
127.0.0.1 localhost

I'm using one of the VirtualBox images that Microsoft provides to test my site in Edge. I'm running into CORS issues since I have to connect to my localhost using http://10.0.2.2:5000, so I'd like to reuse the domain settings from my /etc/hosts.

The node server on my localhost is listening on 0.0.0.0:5000.

I ran this command which is supposed to get guest OSes to use the host's DNS, but I'm not able to load http://dev.mysite.co:5000 inside my VM.

VBoxManage modifyvm "MSEdge - Win10_preview" --natdnshostresolver1 on

Is this command still valid? Is there anything else I should be doing to get this to work?

1 Answer 1

2

/etc/hosts file is not a part of DNS resolver. You could just copy your /etc/hosts to C:\Windows\System32\drivers\etc\hosts but that won't work because from the point of VM 127.0.0.1 is VM's IP (loopback).

For that to work you should add to C:\Windows\System32\drivers\etc\hosts the following line:

 10.0.2.2       dev.mysite.co

which will resolve any dev.mysite.co request inside VM to your host's IP (which is i assume 10.0.2.2 - please check IP of VM adapter on your host's OS, via for example ifconfig vboxnet0)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .