Allow public connections to local Ruby on Rails Development Server

Ruby on-RailsRuby

Ruby on-Rails Problem Overview


I am setting up a RoR development environment on a Windows machine. I was wondering how I can set it up so a few friends of mine can have access to the web server and monitor the progress?

It would only be 2 or 3 people connecting at anytime time max.

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

The simplest way requires NO additional installations: just add a single option to your rails server (or rails s) command when you start up the server:

rails s --binding=0.0.0.0

The 0.0.0.0 address means "listen to requests from anywhere." On many systems, the default is 127.0.0.1, which means "listen to requests from localhost only."

(If you don't also specify a -p or --port option, then the port shall be 3000, as usual.)

Solution 2 - Ruby on-Rails

You can tell your development server to listen on your publicly accessible interface:

If you're running a server via rails server, you can specify the IP to listen on via -b <ip> or --binding=<ip>. By default, the server listens on 0.0.0.0, that is, only for local connections.

Usage: rails server [mongrel, thin, etc] [options]
    -p, --port=port                  Runs Rails on the specified port.
                                     Default: 3000
    -b, --binding=ip                 Binds Rails to the specified ip.
                                     Default: 0.0.0.0

You can instead find out what your machine's network address is and bind to that address instead, but you will have to forward ports and figure out what your publicly routable IP address is on the Internet; this is outside the bounds of Stack Overflow.

Solution 3 - Ruby on-Rails

Give localtunnel a go. It's a ruby gem so you shouldn't have any problem getting it going:

gem install localtunnel
localtunnel 3000

The first time you do that it'll ask you for an ssh key, but once you've got that set it'll show you the public url that you can share. Anything running on the specified port will get exposed at that url.

Showoff-io looks like a similar service, but I haven't used it so I can't comment. Also, it's paid and requires signup.

Solution 4 - Ruby on-Rails

As someone suggested, use [ngrok][1].

It's stupidly easy.

[1]: https://ngrok.com/download "ngrok"

Solution 5 - Ruby on-Rails

Allow remote connections by binding the Rails server to 0.0.0.0.

Here's the short notation for those who don't like typing :

bin/rails s -b 0.0.0.0

If you also want to allow IPv6 connections (Puma):

bin/rails s -b [::]

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDanView Question on Stackoverflow
Solution 1 - Ruby on-RailsJellicleCatView Answer on Stackoverflow
Solution 2 - Ruby on-Railsuser229044View Answer on Stackoverflow
Solution 3 - Ruby on-RailsDavid UnderwoodView Answer on Stackoverflow
Solution 4 - Ruby on-RailsSebastialonsoView Answer on Stackoverflow
Solution 5 - Ruby on-RailsYvoView Answer on Stackoverflow