It’s nice having a chat channel as dead as #sinatra. It makes it trivial to go back through a day and read every message that went through. One of those messages yesterday was from SirSydAlot asking if Sinatra could bind to a certain IP address. I told him at the time that Rack should support it, but Sinatra didn’t yet, so I went to check that fact.
server = ::Mongrel::HttpServer.new(options[:Host] || '0.0.0.0', options[:Port] || 8080)
and in Rack::Handler::Thin
server = ::Thin::Server.new(options[:Host] || '0.0.0.0', options[:Port] || 8080, app)
So I made a patch to add a host option
. It’s pretty simple to use:
# That's it... set :host, '192.168.1.1'
It sounds like the patch will be included in the mainline code soon, so look for that. Until then, be sure to use my host_setting branch, as that’s the only place this patch is.