4

I'm working on an AngularJS application running on NodeJS. I fire up my NodeJS server on localhost:3000 on my OSX development machine. All good! I need to test my AngularJS app on IE10+ so I got a VirtualBox image with Windows 8.1 32-bit and IE11 and got it running. I'm using VirtualBox 5.0.14 (latest as of now). I would like to access my NodeJS server from my guest VM. I can currently achieve this by typing "http://10.0.2.2:3000" on IE in the guest VM. All good! The only issue is that due to some google maps API whitelisting issues I need to be able to go "http://localhost:3000" on IE in my guest VM and this doesn't seem to work for me under any circumstance.

At the risk of asking a duplicate question because I have tried everything posted here but nothing works for me. IE in the guest VM cannot find "localhost:3000".

I do have an entry in the hosts file for 10.0.2.2 localhost in the guest VM. And my network config for my VM on VirtualBox is as follows: enter image description here

I have no ports forwarded currently. I tried forwarding 80 and 3000 without success. I am no networking or VirtualBox expert so would appreciate any help. I'm sure I'm missing something small.

Community
  • 1
  • 1
tkha007
  • 212
  • 3
  • 12
  • Port forwarding on VBox is for inbound, not outbound. Revert the changes you did on `/etc/hosts` to restore `127.0.0.1 localhost`. What you need is ssh port forwarding. From your host run `ssh -R 3000:localhost:3000 VMIP`. This will require `sshd` to be running on your `VM`. – alvits Feb 11 '16 at 01:31
  • Or you can do it from VM, run `ssh -L 3000:localhost:3000 OSXhostIP`. This will require `sshd` to be running on your `OS X`. – alvits Feb 11 '16 at 01:34
  • @alvits I have to admit I have no idea re doing anything SSH from Windows 8.1. I tried using PuTTY to connect to the Host but all I get is a connection refused. Any other options? I have restored my hosts file to its original state which is pretty much empty (everything commented out). – tkha007 Feb 11 '16 at 22:13
  • Did you ever manage to fix this? – J_P Sep 07 '17 at 10:42
  • @Jay Unfortunately no. After this I tried a Win7 image instead and the above worked fine on the Win7 image. I don't have the necessary OS or network knowledge to explain this behaviour unfortunately. Achieved what I needed so moved on. – tkha007 Sep 07 '17 at 23:40
  • @tkha007 Thanks for the reply. It actually turned out that my problem was slightly different, and could be resolved by amending the hosts file in the Windows VM. – J_P Sep 08 '17 at 09:41

0 Answers0