5

I have a Vagrant box with JBoss. I'm trying to forward two ports. My Vagrantfile has the following for that

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 can see in console

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

When I do netstat ports seem to be 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 on the Vagrant box itself, this works fine. I see the JBoss stuff.

When I do curl -v https://localhost:8080 on the host other stuff 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 running on the Vagrant box.

Configuration for forwarding ports at first seems trivial but it now looks like there is more to it. How should this work?

onknows
  • 6,151
  • 12
  • 65
  • 109

1 Answers1

0

I know this is a little too late, but I just encountered an issue similar to this, however I am using Sinatra. After a little research, and as what Al Jacinto said I found out that running your ruby app like this:

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 this is not related somehow but I thought that it might give a hint!

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
H.B
  • 75
  • 1
  • 8