Thiago Peres Thiago Peres - 1 year ago 77
Ruby Question

Cannot access local Sinatra server from another computer on same network

I have a simple Sinatra server that I run through textmate but I can't access from another computer on the same network.

I'm running Ruby 1.9.3p327 and Sinatra 1.4.1 on a Mac OS 10.8.3. Firewall is disabled.

I tested the same scenario on different networks and computers.

The computer responds to simple pings but when I try to telnet port 4567 I can't establish a connection.

Answer Source

There was a recent commit to Sinatra that changed the default listen address to localhost from 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

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

$ ./my_sinatra_file.rb -o