Why Vagrant Port Forwarding Doesn't Work

I have boxing with JBoss. I am trying to forward two ports. My Vagrantfile has the following meanings for

 web.vm.network "forwarded_port", guest: 8080, host: 8080 # jboss web.vm.network "forwarded_port", guest: 9990, host: 9990 # jboss management console 

On vagrant up web I see in the console

 ==> web: Forwarding ports... web: 8080 => 8080 (adapter 1) web: 9990 => 9990 (adapter 1) 

When I do netstat ports it seems ok

 $ sudo netstat -tulpn | grep VirtualBox [sudo] password for ostraaten: tcp 0 0 0.0.0.0:9990 0.0.0.0:* LISTEN 21241/VirtualBox tcp 0 0 127.0.0.1:2222 0.0.0.0:* LISTEN 21241/VirtualBox tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 21241/VirtualBox 

When I do curl -v http://localhost:8080 in the Vagrant box itself, this works fine. I see JBoss stuff.

When I do curl -v https://localhost:8080 on the host, something else happens.

 $ curl -v http://localhost:8080 * Rebuilt URL to: http://localhost:8080/ * Hostname was NOT found in DNS cache * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 8080 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.35.0 > Host: localhost:8080 > Accept: */* > * Recv failure: Connection reset by peer * Closing connection 0 curl: (56) Recv failure: Connection reset by peer 

There is no firewall in the Vagrant field.

The configuration for port forwarding at first seems trivial, but now it looks like it’s more. How should this work?

+5
source share
1 answer

I know this is too late, but I ran into a problem like this, however I use Sinatra. After a little research and what Al Jacinto said, I found out that you are launching your ruby ​​app as follows:

 ruby app.rb -o 0.0.0.0 

( http://www.sinatrarb.com/intro.html )

should solve the problem without the need to edit ruby.rb I apologize if it is not connected in some way, but I thought it might give a hint!

0
source

All Articles