ziyadparekh
ziyadparekh

Reputation: 383

Is it possible to access a localhost from a vagrant devbox?

I'm running my application on a local Vagrant VM on my computer and I was wondering if I created a node server that ran on localhost (also on my computer) would I be able to access the node server from my Vagrant application ?

Upvotes: 18

Views: 13979

Answers (1)

hek2mgl
hek2mgl

Reputation: 158150

With default vagrant settings, you can reach your host computer via the IP 10.0.2.2. This is at least true for the VirtualBox provider. I haven't tested others so far.

If you have configured your node server on the host machine in way that it listens to all IP addresses assigned to your host computer you should be able to access

http://10.0.2.2

from within the vagrant virtual machine.

Upvotes: 47

Related Questions