Ruby-on-rails – Port forwarding vagrant on windows

ruby-on-railsvagrantwindows

I am on windows 7. I have a vagrantfile specified to forward ports for passenger, on vagrant up it claims that it has forwarded the ports, however this is not the case, when I start my application I can run

curl 0.0.0.0:3000

and get a result from my rails application, however outside vagrant I cannot connect to the server. How can I access the port from outside vagrant?

The Vagrantfile contains the following lines

config.vm.network :forwarded_port, guest: 3306, host: 3306 # MySQL

config.vm.network :forwarded_port, guest: 3000, host: 3000 # Passenger

Best Answer

One possibility is that port collision is occurring, eg. something is running on port 3000 of your host machine. According to the Port Forwarding documentation

you can add the auto_correct: true flag which will output any collision and autocorrect details when you vagrant up or vagrant reload.