Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby sinatra remote connection

I'm trying to get hello world working remotely in sinatra:

require 'sinatra'

get '/' do
  "hello world"
end

locally it works fine:

curl localhost:4567
hello world

but when I try to access it remotely, I get a 404 error. The server is visible; I have other web applications running just fine (but not on nonstandard ports). this is a near-stock ubuntu install so there aren't any iptables rules that would block access to port 4567. Is there something I'm missing? I've had difficulty googling this.

like image 867
rsheldiii Avatar asked Mar 28 '13 02:03

rsheldiii


1 Answers

I assume this is not firewall issue. Add bind set :bind, '0.0.0.0' something like below

#app.rb
require 'sinatra'
set :bind, '0.0.0.0'
get "/" do
    "Working"
end

to run this

ruby app.rb
like image 87
ch4nd4n Avatar answered Sep 27 '22 21:09

ch4nd4n