Revisited some work last night, a little api into my home automation work so I can expose it to the web and get started on a phone app. All was working OK previously, thought nothing had changed but suddenly my work was not accessible over the web, only over localhost... This is a common beginners issue with Sinatra 1, if you just make a simple app like
#!/usr/bin/[ruby](/wiki/#ruby)
require 'sinatra'
get '/' do
'Hello!'
endThat will show you a web page saying "Hello!" when you hit the root, ie /. With no other changes this will respond on port 4567, and importantly only be available to localhost no other machines. I knew this, so had this code:
#!/usr/bin/[ruby](/wiki/#ruby)
require 'sinatra'
configure do
set :bind, '0.0.0.0'
end
get '/' do
'Hello!'
endto mean "respond on all ip addresses". But it had stopped working. I tried equivalent options, removing that configure block and trying launching the app with
[api](/wiki/#api).php -o 0.0.0.0and then
[api](/wiki/#api).php -o 192.168.1.[73](/wiki/#73) # the actual ip on my networkand then also
[api](/wiki/#api).php -e productionwhich puts it in production mode (where you'd want to be visible externally). But still no joy.
It just came to me this morning that as I'm working from home I have Junos Pulse enabled on my machine to get me onto the work network, and that is what is fouling it up! Haven't tested it yet as I have to work, but I bet that is it...
⬅️ Happy birthday Folkestone :: Man alive it is hot - has anyone else noticed this? ➡️
Paulʼs weblog - I live in Hythe near Folkestone in the deep South. Wed + father to 2, I am a full-stack web developr, and I do js / node, some ruby, other languages ect ect. My hobbies are pubs, parkrun, eating, home automation + other diy jiggery-pokery, history, family tree stuff, TV, squirrels, pirates ☠️, lego, and TIME TRAVEL.