Skip to Main Content

Access a Local Sinatra App from iPad/iPhone

If you are developing a Rack application locally it's nice to be able to easily test a variety of devices. But if you try to connect via your local IP address, you will find that is doesn't work because by default Rack binds to localhost. In order to accept external connections we need to make Rack bind to 0.0.0.0 instead. You can do this with:

bundle exec rackup --host 0.0.0.0 --port 8080

You can find your local IP address from the OS X System Preferences > Network.

Access a Local Sinatra App from iPad/iPhone, Foreign Gods in

You can now connect from an external device using http://YOUR_IP:8080, e.g. http://10.0.1.14:8080

 

Most RecentRSS

ArchiveRSS

March 2016 (1)
January 2016 (1)
September 2015 (1)
May 2015 (1)
April 2015 (1)
March 2015 (1)
February 2015 (2)
January 2015 (5)
September 2014 (2)
August 2014 (4)
July 2014 (1)
March 2014 (1)
November 2013 (3)
September 2013 (3)
July 2013 (6)
June 2013 (1)
May 2013 (1)
March 2013 (2)
February 2013 (3)
January 2013 (4)