Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
bind not working for sinatra web server

I was trying to post this answer to stackoverflow but I was banned to do that. I believe the answer below may be helpful so I publish it at least this way:

I was running sinatra via MyServer, webrick_options

and after installing sinatra-contrib gem suddenly I was unable to to access my app from outside (localhost was working perfectly). All the hints with bind and -o were not working for me. What finally helped was to put inside webrick_options hash following key and value:

:Host => ''

You can find out why it works by expanding source code of the rack .run method, where you will see following line:

options[:BindAddress] = options.delete(:Host) || default_host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.