rsheldiii
rsheldiii

Reputation: 135

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.

Upvotes: 6

Views: 1372

Answers (1)

ch4nd4n
ch4nd4n

Reputation: 4197

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

Upvotes: 9

Related Questions