Cannot Access Local Sinatra Server from Another Computer on Same Network

Cannot access local Sinatra server from another computer on same network

There was a recent commit to Sinatra that changed the default listen address to localhost from 0.0.0.0 in development mode due to security concerns.

In order to explicitly allow access from the network, you need to either run your app in another mode (e.g. production), or set the bind option to 0.0.0.0.

You can do this from the command line using the built in server using the -o option:

$ ./my_sinatra_file.rb -o 0.0.0.0

Cannot access sinatra app through the local network

Try ruby app.rb -o 0.0.0.0 or ruby app.rb -e production. Either should work.

Cannot access sinatra app on AWS Windows from remote machine

I was able to solve my issue, so for the sake of completeness I am publishing the answer.

This wasn't a Sinatra issue, but an AWS issue (maybe not really an issue, more like my misunderstanding). I was under the impression that updating the AWS security group for opening the 4567 port will do the trick.

However, it turns out that I needed also to open the port on the Windows Firewall on my Windows AWS instance. After opening the port on the Windows Firewall I was able to remotely connect to my Sinatra app.

Can't access Ruby server on VM from host machine

I have the network adapter for my VM attached to NAT. I was forwarding ports 443, 22 and 80 to my VM, and accessing my server on those ports works fine. Since I was running the Ruby WEBrick server on the default port 4567, I just had to forward port 4567 from my host machine to my VM as well.

After that change, typing http://localhost:4567 into my web browser served up the content from my Ruby file.

Ruby Sinatra Webservice running on localhost:4567 but not on IP

Following worked for me.

ruby app.rb -o 0.0.0.0

Can't launch simple Sinatra app using rackup and jRuby (no response from web server)

Well, this is hardly sufficient to explain what is going on, but I can make it work if in config.ru I replace

run Sinatra::Application

with

Sinatra::Application.run!

In fact, knowing that makes me even more confused. Some sort of bug in Rack?



Related Topics



Leave a reply



Submit